Lloyd Thomas
<lloydie-t-d/OCxD/[EMAIL PROTECTED]> wrote:
I wish to create a query where I do a number of counts on the same
table but
with different filters.
ie:
count(id) as numrows
count(id) as inrows where direction = 'In'
count(id) as outrows where direction = 'Out'
Could I do the above in a single query?
select
count(*) as numrows,
count(case direction when 'In' then 1 else NULL end) as inrows,
count(case direction when 'Out' then 1 else NULL end) as outrows
from mytable;
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------