Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: table with sparce data
"Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message news:<9vt1b.18$3j7.31_at_news.oracle.com>...
> Any simple analytical solution?
Here is analytical solution:
SQL> select rn, comm from (
2 select ename, comm
3 ,count(1) over (order by ename) rn 4 ,lead(comm) over (order by ename) lead 5 from commissions
RN COMM
---------- ----------
1 0 2 300 8 0 9 1400 13 0 14 500
Then, all you need to do is subtract RN-LAG(RN) to get the count. Received on Fri Aug 22 2003 - 19:48:32 CDT