Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #704
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | "Bob Barrows" <reb01501@NOSPAMyahoo.com> |
| Newsgroups | comp.databases.ms-sqlserver, microsoft.public.sqlserver.programming |
| Subject | Re: SQL help again |
| Date | Sun, 2 Oct 2011 13:06:56 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 21 |
| Message-ID | <j6a5n5$9d3$1@dont-email.me> (permalink) |
| References | <j6a2kf$3d5$1@speranza.aioe.org> <j6a4ks$9fp$1@speranza.aioe.org> |
| Injection-Date | Sun, 2 Oct 2011 17:06:46 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="inlgCTpOMxujS+VHkVo6dA"; logging-data="9635"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hkfib511SA4Y4LzoO80GjhYZCWZM8+bc=" |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.6109 |
| X-RFC2646 | Format=Flowed; Response |
| X-Antivirus-Status | Clean |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5931 |
| X-Antivirus | avast! (VPS 111002-1, 10/02/2011), Outbound message |
| Cancel-Lock | sha1:xIwkpfcvww5p9RaSQgbhU0LSNV8= |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| Xref | x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:704 |
Cross-posted to 2 groups.
Show key headers only | View raw
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 | Next — Previous in thread | Next in thread | Find similar
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