Article View: borland.public.interbase.sql
Article #11355Selecting row in which a column value is maximum
From: Edward Diener
Date: Sun, 24 Nov 2002 04:15
Date: Sun, 24 Nov 2002 04:15
7 lines
1461 bytes
1461 bytes
How does one select a row in a table in which a column value is the maximum value of all the rows ? The MAX(column_name) syntax does not appear that it can be used in a WHERE clause but only in a SELECT clause to get the maximum value itself. Instead I want all column values for a row where a particular column has the maximum value. It seem as if the only way to do this is to first SELECT MAX(column_name) from ATABLE, and then use the value returned to to a SELECT * FROM ATABLE WHERE column_name = mymax_value .
Technical Details
Message-ID:
<3de051cf@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,60a1aedc82f6444,start X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-11-23 20:36:11 PST From: "Edward Diener" <eddielee@tropicsoft.com> Newsgroups: borland.public.interbase.sql Subject: Selecting row in which a column value is maximum Date: Sat, 23 Nov 2002 23:15:56 -0500 Lines: 9 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 216.175.66.119 Message-ID: <3de051cf@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1038111183 216.175.66.119 (23 Nov 2002 20:13:03 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail