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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: help with query

RE: help with query

From: Cale, Rick T (Richard) <RICHARD.T.CALE_at_saic.com>
Date: Fri, 4 Aug 2000 08:15:51 -0700
Message-Id: <10579.113863@fatcity.com>


How about

SELECT id,amount,MAX(date)
FROM table1
GROUP BY id,amount;

Rick

> -----Original Message-----
> From: Dennis M. Heisler [SMTP:dheisler_at_binghamton.edu]
> Sent: Friday, August 04, 2000 10:46 AM
> To: Ashish Shah
> Cc: dbalist; lazydba
> Subject: Re: help with query
>
> How about
>
> select a.id, a.date, a.amount from table1 a
> where date = (select max(date) from table1 b where a.id = b.id);
>
>
> Dennis
>
>
>
> Ashish Shah wrote:
>
> > 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/
> >
> > --------
> > If you're bored, then visit the list's website: http://www.lazydba.com
> (updated daily)
> > to unsubscribe, send a blank email to
> oracledba-unsubscribe_at_quickdoc.co.uk
> > to subscribe send a blank email to oracledba-subscribe_at_quickdoc.co.uk
>
>
> --------
> If you're bored, then visit the list's website: http://www.lazydba.com
> (updated daily)
> to unsubscribe, send a blank email to oracledba-unsubscribe_at_quickdoc.co.uk
> to subscribe send a blank email to oracledba-subscribe_at_quickdoc.co.uk
Received on Fri Aug 04 2000 - 10:15:51 CDT

Original text of this message

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