Re: Counting two columns with where causes for each
Date: 17 Sep 2002 15:49:44 -0700
Message-ID: <12c0a6d6.0209171449.7b641693_at_posting.google.com>
That's good; I didn't think of using decode + sum in lieu of count.
My solution using views would've worked if I'd remembered to put a
'group by' clause in the final query. But nevermind, this is much
neater.
(btw, the count function happens to count rows with non-null values,
so it works on date_for_raise only because you happen to want a count
of non-null values in that column.)
john
Charlie3101_at_hotmail.com (Charlie Edwards) wrote in message news:<db479d88.0209170521.1e02e76e_at_posting.google.com>...
>
> Am I misunderstanding something here?
> Whats wrong with (assuming it's job 15 you want, not 18) ...
>
> SELECT district,
> race,
> SUM(DECODE(job,15,1,0)) jobcount,
> COUNT(date_for_raise) datecount
> FROM info
> GROUP BY district,race;
>
> CE
Received on Wed Sep 18 2002 - 00:49:44 CEST