469,913 Members | 1,953 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

Count of NULL and NOT NULLS

Jim
How would I write a query to count the number of instances where a the
PREP field is NULL and when it is not null. I know how to do it
seperately, can I get the numbers in the same query. I want something
like this

Project #PREP_NOTNULL #PREP_NULL

Thanks,

Jim

Dec 15 '06 #1
3 7434
que
select concat('isnull(prep) = ' ,isnull(prep)) `condition`, count(*)
`count` from your_table group by isnull(prep)

Jim написав:
How would I write a query to count the number of instances where a the
PREP field is NULL and when it is not null. I know how to do it
seperately, can I get the numbers in the same query. I want something
like this

Project #PREP_NOTNULL #PREP_NULL

Thanks,

Jim
Dec 16 '06 #2
Jim
Thanks,

Is there a way to get the counts in the same ROW

que wrote:
select concat('isnull(prep) = ' ,isnull(prep)) `condition`, count(*)
`count` from your_table group by isnull(prep)

Jim написав:
How would I write a query to count the number of instances where a the
PREP field is NULL and when it is not null. I know how to do it
seperately, can I get the numbers in the same query. I want something
like this

Project #PREP_NOTNULL #PREP_NULL

Thanks,

Jim
Dec 18 '06 #3
que
select count(*) nulls, (select count(*) from your_table where not
isnull(prep)) not_nulls from your_table where isnull(prep)
>
Is there a way to get the counts in the same ROW
Dec 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Bodza Bodza | last post: by
5 posts views Thread by gelangov | last post: by
13 posts views Thread by Federico Balbi | last post: by
1 post views Thread by griemer | last post: by
3 posts views Thread by john | last post: by
ADezii
3 posts views Thread by ADezii | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.