You could turn this into a GROUP BY query

<cfquery name="Getastindex" datasource="wweb">
        SELECT COUNT(ast) AS ast_count, ast
        FROM wweb
        GROUP BY ast
        ORDER BY ast
</cfquery>

Then, your results set would be something like:

ast             ast_count
-----------------------------
ASTAI           50
ASTft           29
ASTindex        35


Should work...

Evan

--
-=-=-=-=-=-=-=-=-=-
Evan Lavidor
Circle.com Boston
Tel: 617-585-3107
Fax: 617-585-3091
-=-=-=-=-=-=-=-=-=-


> -----Original Message-----
> From: Robert Orlini [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, January 31, 2001 4:53 PM
> To: CF-Talk
> Subject: faster count
>
>
> Hello,
>
> I have an Access table that I need to get a count for a specific value in
> each column. The coding below does the trick (on one column), but is too
> slow since I have numerous columns. I'm kinda a newbie on this so I was
> wondering is there away to make the count quicker by combining some of the
> coding?
>
> Thanks in advance.
>
> Robert O.
> HWWADMIN
>
> <cfquery name="Getastindex" datasource="wweb">
>    Select Count(ast) AS ast_count
>    FROM wweb
>    Where ast like 'ASTindex'
>    </cfquery>
>
> <cfquery name="Getastai" datasource="wweb">
>    Select Count(ast) AS astai_count
>    FROM wweb
>    Where ast like 'ASTAI'
>    </cfquery>
>
> <cfquery name="Getastft" datasource="wweb">
>   Select Count(ast) AS astft_count
>    FROM wweb
>    Where ast like 'ASTft'
>    </cfquery>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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