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: Aggregation Problem

Re: Aggregation Problem

From: Carlos <miotromailcarlos_at_netscape.net>
Date: Tue, 23 Oct 2007 05:59:24 -0700
Message-ID: <1193144364.082185.246810@v29g2000prd.googlegroups.com>


On 23 oct, 14:08, Björn Wächter <bwc_at_p3-solutionsKILL_SPAM.de> wrote:
> Hi all,
>
> I'm looking for a function that can calculate the following:
> I have a table like this:
>
> STATE_ID | SERVICE_STATE
> -------------------------------------
> 1 | OK
> 2 | OK
> 3 | ERROR
> 4 | ERROR
> 5 | ERROR
> 6 | ERROR
> 7 | ERROR
> 8 | OK
> 9 | OK
>
> I want a query thats shows all rows of the table but has a new
> column. Which has a kind of group_id that is not changing if the
> SERVICE_SATE is not changing from one STATE_ID to the next per
> SEVICE_ID:
>
> STATE_ID | SERVICE_STATE | CONTINUE_GROUP
> --------------------------------------------------
> 1 | OK | 1
> 2 | OK | 1
> 3 | ERROR | 2
> 4 | ERROR | 2
> 5 | ERROR | 2
> 6 | ERROR | 2
> 7 | ERROR | 2
> 8 | OK | 3
> 9 | OK | 3
>
> So in this example the SERVICE_STATE is changing for
> STATE_ID 2 to 3 from OK to ERROR so there is a new
> CONTINUE_GROUP = 2. And again a change from ERROR to OK
> for STATE_ID 7 to 8 and the new CONTINUE_GROUP = 3.
> Is there an aggregation function that can do this?
>
> Thanks Björn

Analytics rock, analytics roll...

Cheers.

Carlos. Received on Tue Oct 23 2007 - 07:59:24 CDT

Original text of this message

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