Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Cumulative query

Re: Cumulative query

From: Conan <conan_at_>
Date: Wed, 16 Aug 2000 10:59:54 +0100
Message-ID: <nBtm5.15921$r4.8198@news.indigo.ie>

this should work

select a.createdate, count(b.itemid)
from your_table a, your_table b
where b.createdate <= a.createdate
group by a.createdate
/

HTH Conan

ruudbax_at_my-deja.com wrote in message <8ndmfc$6db$1_at_nnrp1.deja.com>...
>I'm trying to write a cumulative query on a table
>that looks like this.
>
>createdate, itemid
>
>If the table would be filled with the following
>data:
>
>01-01-2000 1
>01-01-2000 2
>01-01-2000 3
>02-01-2000 4
>02-01-2000 5
>03-01-2000 6
>04-01-2000 7
>04-01-2000 8
>
>With the simple query by day (select count(*)
>from table group by createdate) I would get the
>number of items created on every date.
>
>I would however like to have a cumulative result,
>so:
>
>Date Number of items
>01-01-2000 3
>02-01-2000 5 <3+2>
>03-01-2000 6 <3+2+1>
>04-01-2000 8 <3+2+1+2>
>
>
>
>
>Sent via Deja.com
http://www.deja.com/
>Before you buy.
Received on Wed Aug 16 2000 - 04:59:54 CDT

Original text of this message

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