| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: A SQL Question
"Telus" <sraisdana_at_l3technology.com> wrote in message news:<_omNb.13141$wf1.11109_at_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
![]() |
![]() |