Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to count grouped records ?

Status
Not open for further replies.

olmos

Technical User
Joined
Oct 25, 2000
Messages
135
Location
US
I have a cfoutput query using a Group = "" . I need to be able to count just the number of groups and place the count number beside the start of a new group in a table.
How do I do this ?

Thanks,
olmos.
 
Hey Olmos,

Something like this will give you the group count.

<cfquery ...
select * from my table
order by myGroup asc
</cfquery>

<cfset groupCount=0>
<cfoutput query=&quot;q1&quot; group=&quot;myGroup&quot;>
<cfset groupCount=groupCount+1>
<cfoutput></cfoutput>
</cfoutput>

<cfoutput>
<table><tr>
<td>(#groupCount#) New Group</td>
</tr></table>
</cfoutput>

Hope this helps,
GJ
 
Thank you GunJack, it worked GREAT!

Olmos.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top