Article View: borland.public.interbase.sql
Article #11391Re: Selecting row in which a column value is maximum
From: Edward Diener
Date: Tue, 26 Nov 2002 00:10
Date: Tue, 26 Nov 2002 00:10
19 lines
2204 bytes
2204 bytes
"Craig Stuntz [TeamB]" <cstuntz@nospamplease.com (but use vertexsoftware to email)> wrote in message news:MPG.184c493d33d5246b98a267@newsgroups.borland.com... > In article <3de27571$1@newsgroups.borland.com>, eddielee@tropicsoft.com > says... > > If the index is sorted based on the index value, which seems pretty natural > > so that a particular record can be found easily based on its index, then > > going to the last record of the index of an ascending index will give the > > max value. > > > Keep in mind that the last record pointed to in the index might not > be visible to the current transaction. If I am controlling the transaction, then I wouldn't be doing so by allowing the index to be updated while I need to get the maximum value for my key column. I will pass a transaction as part of my SQL statement that freezes the table from being updated until I can get back my value.
Technical Details
Message-ID:
<3de2bb5b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!eurocyber.net!newsfeed.muc.eurocyber.net!news.ipv6.iphh.net!iphh.net!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3de051cf@newsgroups.borland.com> <3de0d0f0$1@newsgroups.borland.com> <MPG.184c120210a6b55a98a253@newsgroups.borland.com> <3de24925@newsgroups.borland.com> <MPG.184c1b6154274d7b98a260@newsgroups.borland.com> <3de27571$1@newsgroups.borland.com> <MPG.184c493d33d5246b98a267@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,60a1aedc82f6444 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-11-25 16:09:43 PST From: "Edward Diener" <eddielee@tropicsoft.com> Newsgroups: borland.public.interbase.sql References: <3de051cf@newsgroups.borland.com> <3de0d0f0$1@newsgroups.borland.com> <MPG.184c120210a6b55a98a253@newsgroups.borland.com> <3de24925@newsgroups.borland.com> <MPG.184c1b6154274d7b98a260@newsgroups.borland.com> <3de27571$1@newsgroups.borland.com> <MPG.184c493d33d5246b98a267@newsgroups.borland.com> Subject: Re: Selecting row in which a column value is maximum Date: Mon, 25 Nov 2002 19:10:45 -0500 Lines: 21 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: 66.32.65.244 Message-ID: <3de2bb5b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1038269275 66.32.65.244 (25 Nov 2002 16:07:55 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newsfeed.gamma.ru!Gamma.RU!eurocyber.net!newsfeed.muc.eurocyber.net!news.ipv6.iphh.net!iphh.net!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail