Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #720

Re: SQL help again

From "phil hunt" <a@abc.com>
Newsgroups comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming
Subject Re: SQL help again
Date 2011-10-02 18:44 -0400
Organization Aioe.org NNTP Server
Message-ID <j6apfh$5o6$1@speranza.aioe.org> (permalink)
References <j6a2kf$3d5$1@speranza.aioe.org> <j6a4ks$9fp$1@speranza.aioe.org> <j6a5n5$9d3$1@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


 That's it.Thanks.


"Bob Barrows" <reb01501@NOSPAMyahoo.com> wrote in message 
news:j6a5n5$9d3$1@dont-email.me...
> 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
>
>
>
> 

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

SQL help again "Phil Hunt" <aaa@aaa.com> - 2011-10-02 12:14 -0400
  Re: SQL help again "Phil Hunt" <aaa@aaa.com> - 2011-10-02 12:48 -0400
    Re: SQL help again "Bob Barrows" <reb01501@NOSPAMyahoo.com> - 2011-10-02 13:06 -0400
      Re: SQL help again "phil hunt" <a@abc.com> - 2011-10-02 18:44 -0400
      Re: SQL help again "Bob Barrows" <reb01501@NOyahooSPAM.com> - 2011-10-03 12:09 -0400
  Re: SQL help again --CELKO-- <jcelko212@earthlink.net> - 2011-10-03 08:55 -0700

csiph-web