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

Home -> Community -> Mailing Lists -> Oracle-L -> SQL question

SQL question

From: SCOTT LEANNE T <SCOTT_LEANNE_T_at_LILLY.COM>
Date: Fri, 12 Jan 1996 13:45:08 +0000
Message-Id: <9601121401.AA10370@alice.jcc.com>


Hi! I would appreciate help on the following SQL question. I have a table that contains data such as:
ID Name Value1 Value2 Systime

----  ------  ------    ------    -------
1     AAA     10        25        01-Jan-1996
1     BBB     100       250       01-Dec-1995
1     AAA     20        50        10-Jan-1996
1     BBB     200       20        05-Jan-1996
1     MMM     250       240       11-Jan-1996
etc.

I would like to write a SQL statement to return the name, value1, value2 and systime where the systime is the most recent for a distinct name. For instance, the output would give me the row with name AAA and systime 10-Jan-1996 and
the row with name BBB and systime 05-Jan-1996, etc. I have tried to use functions such as max and group by but because I want the values printed, I can't get the report to come together. Any ideas?

Thanks for any help!

Leanne
leanne_at_lilly.com
(Oracle 7.1, HPUX) Received on Fri Jan 12 1996 - 09:01:49 CST

Original text of this message

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