recordcount is the number of records returned by the query. you're looking
for something like

        select  agency, count(*) as thecount
        from    oimdbadm.assigned
        where   completed = 'Incomplete'
        GROUP BY agency
        ORDER BY agency

this will give you the number of times an agency has Incomplete associated
with it.


chris olive, cio
cresco technologies
[EMAIL PROTECTED]
http://www.crescotech.com



-----Original Message-----
From: James Taavon [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 10, 2001 4:07 PM
To: CF-Talk
Subject: What should be easy has eluded me...


I am trying to distinctly count the number occurences of jobs for
different agencies in my application. The query spits back all records
giving the total in the system being 47 and listing it 47 times against
each agency. This obviously is not what I want. How do I get the output
to read

Agency 1      3
Agency 2      6
Agency 3      7

and so forth......


The query below produces the following output.

<cfquery name="ActiveAgency" datasource="OIMDBADM">
        select  agency
        from    oimdbadm.assigned
        where   completed = 'Incomplete'
</cfquery>


<cfoutput query="activeagency">
<b>#activeagency.agency#, #activeagency.recordcount#</b><br>
</cfoutput>


Occupational & Professional Licensing , 47
Employment & Training , 47
Financial Regulation , 47
Occupational & Professional Licensing , 47
Office of the Secretary , 47
Office of the Secretary , 47
Office of the Secretary , 47
Office of the Secretary , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Labor & Industry , 47
Office of the Secretary , 47
Occupational & Professional Licensing , 47
Office of the Secretary , 47
Office of the Secretary , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Office of the Secretary , 47
Office of the Secretary , 47
Office of the Secretary , 47
Financial Regulation , 47
Financial Regulation , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Office of the Secretary , 47
Office of the Secretary , 47
Employment & Training , 47
Office of the Secretary , 47
Occupational & Professional Licensing , 47
Office of the Secretary , 47
Employment & Training , 47
Occupational & Professional Licensing , 47
Office of the Secretary , 47
Financial Regulation , 47
Financial Regulation , 47
Racing , 47
Office of the Secretary , 47
Occupational & Professional Licensing , 47
Employment & Training , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Occupational & Professional Licensing , 47
Financial Regulation , 47
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to