| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: how to create query ??????????
Well see the magic of "analytic function" ...
select * from t_analytic;
QTY START_ID END_ID
---------- ---------- ----------
1 1 100
1 1 100
2 101 200
1 101 200
3 201 300
select distinct sum(qty) over(partition by start_id,end_id) sqty,
min(start_id) over(partition by start_id,end_id) mstart_id,
max(end_id) over(partition by start_id,end_id) xend_id
from t_analytic
/
SQTY MSTART_ID XEND_ID
---------- ---------- ----------
2 1 100
3 101 200
3 201 300
Regards,
Siva
Received on Tue Jan 20 2004 - 20:06:42 CST
![]() |
![]() |