Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: help with query
Hai Ashish,
I think This query will help to you.
(Make Self Joining)
select max(to_char(a.date1,'dd/mm/yyyy hh:mi am')),a.amount,a.id from table
a
where
to_char(a.date1,'dd/mm/yyyy hh:mi am')=(select
max(to_char(b.date1,'dd/mm/yyyy hh:mi am'))
from table b where
a.id=b.id)
group by
a.amt,a,id;
Regards.
Sultan.
> Hi all,
>
> Here is the data..
>
> id date amount
>
> 1 15-jul-00 100
> 1 15-jul-00 50
> 1 15-jul-00 200 <<<<<<<<
> 2 15-jul-00 50
> 2 15-jul-00 100 <<<<<<<<
>
> I need to get a row with max(date) (Date field is
> with time so we can get last row that was inserted)
> for each user..
>
>
> so my output should be
>
> 1 15-jul-00 200
> 2 15-jul-00 100
>
>
> Any idea??
>
> TIA
>
>
>
> =====
> Ashish
> Toronto, Canada
>
> __________________________________________________
> Do You Yahoo!?
> Kick off your party with Yahoo! Invites.
> http://invites.yahoo.com/
> --
> Author: Ashish Shah
> INET: ar_shah_at_yahoo.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
Received on Mon Aug 07 2000 - 00:39:26 CDT