Answered
cfpoutput query group
I posted something like this previously and thought I got it
to work, but not it does not work.
I have a table with state, cities within each state, and multiple codes for each city.
For each state, I want to list all the cities within each state alphabetically, and then the city codes and count for each city.
The output should look like this :
California
Los Angeles
1 (150)
4 (35)
San Diego
1 (350)
4(433)
San Francisco
1 (67)
etc...
This is what I am getting, using the code below :
California
Los Angeles
1 (150)
San Diego
1 (350)
San Francisco 1 (67)
Los Angeles
4 (35)
San Diego
4 (443)
<cfoutput query="qry" group="state">
<td valign="top">
<b>#state#</b>
<br>
<cfoutput group="city">
#city#
<br>
<cfoutput>
<cfif citgy_code is "4">
<a href="link goes here>#city_code# (#totalcount#)</a><br>
<cfelseif city_code is "1">
<a href="link goes here">#city_code# (#totalcount#)</a><br>
</cfif>
</cfoutput>
</cfoutput>
</td>
</cfoutput>
What do I need to do with the above code to group all of the cities together, listing all of the codes, instead of having the cities separated by the code ?
Thanks for any help.
I have a table with state, cities within each state, and multiple codes for each city.
For each state, I want to list all the cities within each state alphabetically, and then the city codes and count for each city.
The output should look like this :
California
Los Angeles
1 (150)
4 (35)
San Diego
1 (350)
4(433)
San Francisco
1 (67)
etc...
This is what I am getting, using the code below :
California
Los Angeles
1 (150)
San Diego
1 (350)
San Francisco 1 (67)
Los Angeles
4 (35)
San Diego
4 (443)
<cfoutput query="qry" group="state">
<td valign="top">
<b>#state#</b>
<br>
<cfoutput group="city">
#city#
<br>
<cfoutput>
<cfif citgy_code is "4">
<a href="link goes here>#city_code# (#totalcount#)</a><br>
<cfelseif city_code is "1">
<a href="link goes here">#city_code# (#totalcount#)</a><br>
</cfif>
</cfoutput>
</cfoutput>
</td>
</cfoutput>
What do I need to do with the above code to group all of the cities together, listing all of the codes, instead of having the cities separated by the code ?
Thanks for any help.
