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 -> Re: Select a single row

Re: Select a single row

From: Anurag Varma <avoracle_at_gmail.com>
Date: 20 May 2005 12:31:03 -0700
Message-ID: <1116617463.961783.194770@g44g2000cwa.googlegroups.com>

ORA92> select * from tabA;

COLA COLB
---------- ----------

FOO        BAR
XYZ        ABC

ORA92> select * from tabB;

COLC COLD ADD_DATE

---------- ---------- ------------------------
AAA        FOO        10-MAY-05 15:20:52
BBB        FOO        19-MAY-05 15:21:05
UUU        XYZ        15-MAY-05 15:21:25
YYY        XYZ        31-MAR-05 15:21:38

ORA92>
ORA92> select colA, colB, min(colC) keep (dense_rank last order by
(add_date))

  2 from tabA, tabB
  3 where tabA.colA = tabB.colD
  4 and tabA.colA = 'FOO'
  5 group by colA, colB
  6 /

COLA COLB MIN(COLC)K
---------- ---------- ----------
FOO BAR BBB

ORA92>
ORA92>
ORA92> select colA, colB, min(colC) keep (dense_rank last order by

(add_date))

  2 from tabA, tabB
  3 where tabA.colA = tabB.colD
  4 and tabA.colA = 'XYZ'
  5 group by colA, colB
  6 /

COLA COLB MIN(COLC)K
---------- ---------- ----------
XYZ ABC UUU Received on Fri May 20 2005 - 14:31:03 CDT

Original text of this message

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