Multiple counts
From: ciccio <ciccio_at_ciccio.it>
Date: Fri, 18 Mar 2005 17:37:27 +0100
Message-ID: <423b0488_1_at_x-privat.org>
Hi,
Date: Fri, 18 Mar 2005 17:37:27 +0100
Message-ID: <423b0488_1_at_x-privat.org>
Hi,
[Quoted] [Quoted] I'd like to write a query that returns a series of count(*) horizontally.
Pratically, if I have such a table:
Name Amount Category
John 1000 1 Jim 1500 2 Mary 750 1 George 2000 2 Melanie 3000 2
I'd like to do like this:
SELECT COUNT(*) AS CAT1 FROM MYTABLE WHERE CATEGORY = 1, SELECT COUNT(*) AS CAT2 FROM MYTABLE WHERE CATEGORY = 2 in order to obtain:
CAT1 CAT2
2 3
That is what I need. How can I rewrite the query (the one above of course doesn't work) in order to obtain this result?
Thanks Received on Fri Mar 18 2005 - 17:37:27 CET