home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / database / 9270 next >
Encoding:
Text File  |  1993-01-21  |  1.8 KB  |  45 lines

  1. Newsgroups: comp.databases
  2. Path: sparky!uunet!spool.mu.edu!uwm.edu!linac!att!cbnewse!cbnewsd!att-out!pacbell.com!rtech!ingres!jonm
  3. From: jonm@Ingres.COM (Don't Judge a book by your cover)
  4. Subject: Re: Counting Null Values in an SQL Query
  5. Message-ID: <1993Jan21.092811.13704@pony.Ingres.COM>
  6. Summary: 
  7. News-Software: VAX/VMS VNEWS 1.41    
  8. Keywords: I am a Beginner
  9. Organization: University of Arizona MIS Department - Mosaic Group
  10. References: <1993Jan20.233912.13272@mnemosyne.cs.du.edu>
  11. Date: 21 Jan 93 09:28:11 GMT
  12. Lines: 31
  13.  
  14. In article <1993Jan20.233912.13272@mnemosyne.cs.du.edu>, afadel@nyx.cs.du.edu (Ayman Fadel) writes...
  15. >The problem is I'm also supposed to count the
  16. >number of patients in each unit form whom no
  17. >value of acuity was entered, ie. level is null.
  18. >This is what i got
  19. >select   station,
  20. >         level,
  21. >         count(level)       
  22. >from ag_medical                      //the name of the table
  23. >where in_house='YES'
  24. >group by station, level
  25. >order by station, level
  26. >Everything is good except that I cannot get a count for the
  27. >number of patients without an acuity.
  28.  
  29. That is because aggregates ignore NULLS.  If you do count(*) it should work.
  30.  
  31. Jon
  32.  
  33. +---------------------------------------------------------------------------+
  34. |Jon Machtynger (jonm@ingres.com)                                           |
  35. |Ingres Technology Centre. Wharfedale Rd,                                   |
  36. |Winnersh, Wokingham. Berks UK.   (0734)-496525                             |
  37. +---------------------------------------------------------------------------+
  38. | Ahhh Brisbane, people actually get paid to work there... in the sun with  |
  39. | all that fresh air and cheap petrol.... Or so legend has it               |
  40. +---------------------------------------------------------------------------+
  41.