You could do something like this:

SELECT TOP 1 (select count(qty) from items where qty = 1) AS num_1s, (select
count(qty) from items where qty = 2) AS num_2s
FROM items
GROUP BY qty

I'm sure there's a more efficient way to do this, but this should work.


----- Original Message -----
From: "Hawkes, Keith A CIV" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 6:17 AM
Subject: Count(*) Query


> I have a table that has one field that holds numbers 1 thru 9.  Can I run
a
> single query that will give me the count(*) of 1's, count(*) of 2's, etc.
or
> do I have to run a separate query for each?
>
> Thanks to all,
>
> Keith
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to