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: James Cummings <no**-*spam***-***jc1635_at_attbi.com>
Date: Sun, 12 Jan 2003 15:30:21 GMT
Message-ID: <hSfU9.25754$Dn.3444@sccrnsc03>


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...

>
> 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 - 09:30:21 CST

Original text of this message

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