Article View: comp.lang.pascal.delphi.databases
Article #82Re: An alternate to GROUP BY???
From: Ralf Jansen
Date: Fri, 29 Jun 2001 11:12
Date: Fri, 29 Jun 2001 11:12
29 lines
1773 bytes
1773 bytes
tallrobert@yahoo.com (Robert) wrote in message news:<7ab1d842.0106281001.52711997@posting.google.com>... > Hi, > > After much reading of posts in these newsgroups, I am at a quandary. > Before launching into a long description, a simple example will > probably do better: > > .... > > Thanks in advance, > Pulling my Hair Out Hello, the 'group by' clause won't help you here ,because you don't want to have a grouped result. You want to have a concrete record with a specific (max) value. One way to do this is to use a subselect for filtering your result to the records with the max cost. SELECT CustNo, Cost, ProdName FROM ORDERS o WHERE Cost = (select max(Cost) from ORDERS i where i.CustNo = o.CustNo) Good Luck, Ralf
Technical Details
Message-ID:
<7c703d5b.0106290312.760381b0@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!postnews1.google.com!not-for-mailReferences:
<7ab1d842.0106281001.52711997@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ffff5,bd3b5dea6a171203 X-Google-Attributes: gidffff5,public X-Google-Thread: 10de66,bd3b5dea6a171203 X-Google-Attributes: gid10de66,public X-Google-ArrivalTime: 2001-06-29 04:12:24 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!postnews1.google.com!not-for-mail From: Ralf.Jansen@Schoenmackers.de (Ralf Jansen) Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.sqlservers Subject: Re: An alternate to GROUP BY??? Date: 29 Jun 2001 04:12:23 -0700 Organization: http://groups.google.com/ Lines: 29 Message-ID: <7c703d5b.0106290312.760381b0@posting.google.com> References: <7ab1d842.0106281001.52711997@posting.google.com> NNTP-Posting-Host: 62.153.98.65 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 993813143 20925 127.0.0.1 (29 Jun 2001 11:12:23 GMT) X-Complaints-To: groups-support@google.com NNTP-Posting-Date: 29 Jun 2001 11:12:23 GMT