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: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Sun, 12 Jan 2003 00:35:06 GMT
Message-ID: <_K2U9.30241$%n.7594@sccrnsc02>


Not exactly sure. An small sample of the table would help. I'm guessing at what you want.

Try
select

    (select id1 from myTable where col_w_id='id1' and date_entered=

        ( select max(date_entered) from myTable where col_w_id='id1')     ),
    (select id2 from myTable where col_w_id='id2' and date_entered=

        ( select max(date_entered) from myTable where col_w_id='id2') ,...
from dual;

Jim
"James Cummings" <no**-*spam***-***jc1635_at_attbi.com> wrote in message news:uo2U9.42042$3v.6049_at_sccrnsc01...
> I'm missing something here I know, so give me a nudge.
>
> I've got a table with data that is collected hourly. In other
> words, there is an ID field several other fields and fianally a
> date field for when the data was collected. Much like a log
> file if you will. What I need to do is pull the last timestamp entry
> for each ID. ID 1 may be in the table 200 times ranging from
> the first of the month to the last of the month. ID 2 may only be
> in the table 5 times during the same range. I don't really care,
> I just need one output for each ID with the data from the last
> timestamp.
>
> Any thoughts?
>
> --
>
> James Cummings
> "Chaos, panic, disorder.... my work is done."
>
Received on Sat Jan 11 2003 - 18:35:06 CST

Original text of this message

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