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: Find the first record, for every day

Re: Find the first record, for every day

From: T <t_at_yahoo.com>
Date: Wed, 21 Dec 2005 11:14:18 +0100
Message-ID: <dob9v1$a7g$1@ss405.t-com.hr>

<ohahaahr_at_hotmail.com> wrote in message news:1135158524.098885.125110_at_g49g2000cwa.googlegroups.com...
> Hi !
>
> I have a tricky problem, and i can't solve it.
>
> I have the following table T1, with the following fields and records:
>
> Date_ Status
> ---------- -------
> 2005-12-01 2
> 2005-12-01 1
> 2005-12-17 1
> 2005-12-18 2
> 2005-12-18 10
>
> I want to generate on output, that gives me the "first" record every
> day. The output should look like this:
>
>
> Date_ Status
> ---------- -------
> 2005-12-01 2
> 2005-12-17 1
> 2005-12-18 2
>
>
> This appears to be a very simple problem, but i can't find the
> solution. Can anybody give me a hint ? (I have tried with rownum, but
> that didn't work).
>
>
> Regards,
> Ole
>

if i understood,
try to use analytic function,
else explain Status a bit more..

select Date_, Status, min(SEQ) from
(
select Date_, Status, Row_Number() over (partition by Date_, Status order by Date_, Status) Seq
from Table
)
group by Date_, Status Received on Wed Dec 21 2005 - 04:14:18 CST

Original text of this message

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