SELECT    ast, count(ast) AS counter
FROM      wweb
WHERE     ast IN ('ASTIndex', 'ASTAI', 'ASTft')
GROUP BY  ast

You're using LIKE improperly here as it's useless w/o a wildcard (%) char;
just use = if you want a direct match. If you do need the wildcard use a ast
LIKE '%foo%' OR ast LIKE '%bar' instead of the IN().

-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]]
Sent: January 31, 2001 16:53
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to