home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / database / sybase / 589 < prev    next >
Encoding:
Text File  |  1993-01-04  |  947 b   |  30 lines

  1. Newsgroups: comp.databases.sybase
  2. Path: sparky!uunet!psinntp!ctp!kdomb
  3. From: kdomb@ctp.com (Kevin Dombroski)
  4. Subject: Re: group by, max(), and unexpected results
  5. Message-ID: <1993Jan4.212029.27356@ctp.com>
  6. Keywords: unexpected results :-(
  7. Sender: news@ctp.com
  8. Nntp-Posting-Host: punch.ctp.com
  9. Organization: Cambridge Technology Partners
  10. References: <1993Jan4.194100.25504@ctp.com>
  11. Distribution: usa
  12. Date: Mon, 4 Jan 1993 21:20:29 GMT
  13. Lines: 15
  14.  
  15. This is what I was looking for...
  16.  
  17.  
  18. select distinct field1, max(field2) 'max field2', field3
  19. from #junk
  20. group by field1
  21. having field2 = max(field2)
  22. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  23. order by field1
  24.  
  25. -- 
  26. ================================================================================
  27. Kevin M. Dombroski                  | "One good thing about music,
  28. Cambridge Technology Partners       |  When it hits, you feel no pain...." 
  29. ================================================================================
  30.