Retrieving database record with the lowest value in field aaa?
From: George Dainis <george.dainis_at_bluecorner.com>
Date: Thu, 27 Jan 2005 19:50:22 +0100
Message-ID: <ctbd5d$sq3$00$1_at_news.t-online.com>
How do I code a SQL SELECT statement so that always only this record is retrieved which matches a certain criteria AND has the lowest ID (= value in key field aaa)?
Date: Thu, 27 Jan 2005 19:50:22 +0100
Message-ID: <ctbd5d$sq3$00$1_at_news.t-online.com>
How do I code a SQL SELECT statement so that always only this record is retrieved which matches a certain criteria AND has the lowest ID (= value in key field aaa)?
It must me something like
SELECT * FROM .... WHERE somefield='somevalue' AND aaa=lowestkey(column(aaa))
As a result either zero or at most 1 record should be passed back.
George Received on Thu Jan 27 2005 - 19:50:22 CET