Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Retrieving database record with the lowest value in field aaa?

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@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 - 12:50:22 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US