Connecting Tech Pros Worldwide Help | Site Map

Count of NULL and NOT NULLS

Jim
Guest
 
Posts: n/a
#1: Dec 15 '06
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

que
Guest
 
Posts: n/a
#2: Dec 16 '06

re: Count of NULL and NOT NULLS


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

Jim написав:
Quote:
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
Jim
Guest
 
Posts: n/a
#3: Dec 18 '06

re: Count of NULL and NOT NULLS


Thanks,

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



que wrote:
Quote:
select concat('isnull(prep) = ' ,isnull(prep)) `condition`, count(*)
`count` from your_table group by isnull(prep)
>
Jim написав:
Quote:
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
que
Guest
 
Posts: n/a
#4: Dec 20 '06

re: Count of NULL and NOT NULLS


select count(*) nulls, (select count(*) from your_table where not
isnull(prep)) not_nulls from your_table where isnull(prep)
Quote:
>
Is there a way to get the counts in the same ROW
>
Closed Thread