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: Vidya Kalyanaraman <kvidya13_at_hotmail.com>
Date: Fri, 04 Aug 2000 11:25:58 EDT
Message-Id: <10579.113867@fatcity.com>


Hi All,
Pls look at the following.
SQL> select * from test order by id;

ID CHK_DT AMOUNT

---------- --------- ----------
1          04-AUG-00        100
1          04-AUG-00         50
1          04-AUG-00        200
2          04-AUG-00        100
2          04-AUG-00         50

SQL> l
  1 select id, max(amount)
  2 from test
  3* group by id
SQL> / ID MAX(AMOUNT)
---------- -----------

1                  200
2                  100

Hope it helps

Thanks
Vidya

From: Ashish Shah <ar_shah_at_yahoo.com>
To: dbalist <ORACLE-L_at_fatcity.com>, lazydba <oracledba_at_quickdoc.co.uk> Subject: help with query
Date: Fri, 4 Aug 2000 07:42:08 -0700 (PDT)

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
Received on Fri Aug 04 2000 - 10:25:58 CDT

Original text of this message

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