ROWNUM
From: Hareesh <Hareesh.Gunti_at_rapistan.com>
Date: 10 Sep 2001 07:23:53 -0700
Message-ID: <48b2e14.0109100623.6193d83d_at_posting.google.com>
Date: 10 Sep 2001 07:23:53 -0700
Message-ID: <48b2e14.0109100623.6193d83d_at_posting.google.com>
Hi,
I have a table say Table1
with Field1, Field2, FieldDate
Field1, Field2 is the Primary Key
SELECT * FROM (SELECT * FROM Table1 ORDER BY FieldDate) WHERE Field1 = 1 AND ROWNUM < 2;
Gives one Record for Field1 = 1
Similarly for Field1 = 2 and Field1 = 3
SELECT * FROM (SELECT * FROM Table1 ORDER BY FieldDate)
WHERE Field1 = 2 AND ROWNUM < 2;
SELECT * FROM (SELECT * FROM Table1 ORDER BY FieldDate)
WHERE Field1 = 3 AND ROWNUM < 2;
Instead of writing multiple SELECT stmts or using a For Loop How can I accomplish this in a single SELECT stmt so that I get 1 record for each value of Field1
Thanks in advance
Hareesh
Received on Mon Sep 10 2001 - 16:23:53 CEST