I have more then one date in the table..
so I can't do max(date).. that will give me
row with max date in whole table..
- "Dennis M. Heisler" <dheisler_at_binghamton.edu>
wrote:
> 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
> >
> > From MAILER-DAEMON Wed Dec 4 15:42:15 1996
> Date: Wed, 4 Dec 1996 15:42:15 -0800 (PST)
> From: Mail System Internal Data
> <MAILER-DAEMON_at_four11.com>
> Subject: DON'T DELETE THIS MESSAGE -- FOLDER
> INTERNAL DATA
> Content-Length: 67
> X-RocketMail: 00000000;----------------
> X-MsgStoreVersion: 001.000
> X-IdxFileVersion: 000.000
> X-LastCompact: ___________________
> X-LastRebuild: ___________________
> X-LastLock: ______________________
> X-LastXactionId: _________________
> X-LastArchive: ___________________
> X-LastBackup: ____________________
> X-Spare0: ________________________
> X-Spare1: ________________________
> X-Spare2: ________________________
> X-Spare3: ________________________
> X-Spare4: ________________
Ashish
Toronto, Canada
Do You Yahoo!?
Received on Fri Aug 04 2000 - 10:13:09 CDT