![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
How do I count a column that is NULL without CASE. I was looking at NULLIF and ISNULL, they can't seem to do the job. Thanks Sorry about double posting, I replied to my question by mistake. |
#3
| |||
| |||
|
|
I tried CASE EventID when NULL then 1 else 0 end It always return 0, why ? Because the way you have the statement structured is causing an equality |
#4
| |||
| |||
|
|
Phil Hunt wrote: I tried CASE EventID when NULL then 1 else 0 end It always return 0, why ? Because the way you have the statement structured is causing an equality comparison to be performed, the result of which will always be false. You have to structure it like: CASE when EventID IS NULL then 1 else 0 end To answer your original question, you can subtract the result of count(distinct column_name) from count(*): select count(*) - count(distinct eventid) as null_eventids |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
To answer your original question, you can subtract the result of count(distinct column_name) from count(*): select count(*) - count(distinct eventid) as null_eventids |
![]() |
| Thread Tools | |
| Display Modes | |
| |