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

Home -> Community -> Usenet -> comp.databases.oracle -> A SQL Question

A SQL Question

From: Telus <sraisdana_at_l3technology.com>
Date: Thu, 15 Jan 2004 01:54:02 GMT
Message-ID: <_omNb.13141$wf1.11109@edtnps89>

A SQL question

Hi Everybody,
Imagine I have a file with 7 records
and two fields with these data:

Record1--Field1=1--Field2=10:45pm
Record2--Field1=1--Field2=10:46pm
Record3--Field1=2--Field2=10:47pm
Record4--Field1=2--Field2=10:48pm
Record5--Field1=2--Field2=10:49pm
Record6--Field1=1--Field2=10:50pm
Record7--Field1=1--Field2=10:51pm

How can I write a SQL to give me
Records 2,5 and 7, fields 1 and 2?

I mean I sort records base on field 2 then for each change on field1, I need one record that can be max or min of field2,
I couldn't use group by because group by consider all record with field1 value of 1 one group but I need one record for each changes on record1,

Thank you in advance - Sasan Received on Wed Jan 14 2004 - 19:54:02 CST

Original text of this message

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