We help IT Professionals succeed at work.
Get Started

Grouping question

Eric Bourland
Last Modified: 2012-05-11
ColdFusion 9
MS SQL Server 2005

Hi. My CFOUTPUT does not group on column PublicationYear the way that I think it should. =) How can I edit my query or my output to get this result:

"CEP scheduled no meetings in year 2011."

rather than this result:

"CEP scheduled no meetings in year 20112011201120112011201120112011201120112011201120112011201120112011."

I am guessing I cannot group variable #url.selectedYear# on column PublicationYear because variable #url.selectedYear# is not referenced in query getDocumentYears.

Thanks as always for advice. I've been puzzling over this task for a while today.


Query, getDocumentYears:

<!--- query to select document publication years --->
<cfquery name="getDocumentYears" datasource="#application.datasource#">
SELECT DISTINCT Year(DocumentPublicationDate) AS PublicationYear
FROM tbl_CEP_Documents
ORDER BY PublicationYear DESC


<p>CEP scheduled no meetings in year <cfoutput query="getDocumentYears" group="PublicationYear" groupcasesensitive="no">#url.selectedYear#</cfoutput>.</p>

Example: http://www.cep-dc.org/meetings/index.cfm?selectedYear=2011

Open in new window

Watch Question
Most Valuable Expert 2015
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE