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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL question

Re: SQL question

From: Thomas Niering <thomas.niering_at_arcor.de>
Date: 12 Jan 2003 10:08:00 +0200
Message-ID: <8djG52m2XzB.thomas.niering@arcor.de>

Hallo James,

> I just need one output for each ID with the data from the last
> timestamp.

First you must select the last timestamp for each id: id, max(timestamp)

Because you need the data of the last timestamp, you should use the results of the first select to get the result in a second select:

select * from <your_table>
where (id, timestamp) in (select id, max(timestamp) from <your_table>)

Ciao Thomas Received on Sun Jan 12 2003 - 02:08:00 CST

Original text of this message

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