Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL question
Thanks, guys. That got me going.
I wound up with a set of union doing the job.
First grab the max timestamp and then getting
the ID number and that timestamp from the
table.
-- James Cummings "Chaos, panic, disorder.... my work is done." "Thomas Niering" <thomas.niering_at_arcor.de> wrote in message news:8djG52m2XzB.thomas.niering_at_arcor.de...Received on Sun Jan 12 2003 - 09:30:21 CST
>
> 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
>