home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.databases.sybase
- Path: sparky!uunet!psinntp!ctp!kdomb
- From: kdomb@ctp.com (Kevin Dombroski)
- Subject: Re: group by, max(), and unexpected results
- Message-ID: <1993Jan4.212029.27356@ctp.com>
- Keywords: unexpected results :-(
- Sender: news@ctp.com
- Nntp-Posting-Host: punch.ctp.com
- Organization: Cambridge Technology Partners
- References: <1993Jan4.194100.25504@ctp.com>
- Distribution: usa
- Date: Mon, 4 Jan 1993 21:20:29 GMT
- Lines: 15
-
- This is what I was looking for...
-
-
- select distinct field1, max(field2) 'max field2', field3
- from #junk
- group by field1
- having field2 = max(field2)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- order by field1
-
- --
- ================================================================================
- Kevin M. Dombroski | "One good thing about music,
- Cambridge Technology Partners | When it hits, you feel no pain...."
- ================================================================================
-