472,126 Members | 1,596 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,126 software developers and data experts.

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 7507
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.