Re: how to create query ??????????

From: Siva Valiveru <linuxurl_at_yahoo.com>
Date: 20 Jan 2004 18:06:42 -0800
Message-ID: <e4c73cce.0401201806.4d67790c_at_posting.google.com>


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 Wed Jan 21 2004 - 03:06:42 CET

Original text of this message