0 Replies Latest reply: Apr 6, 2011 8:51 AM by Vikas Singh RSS

    how to sum the column value based on the distinct value of other column

    Vikas Singh

       

       

       

       

       

       

      SELECT

       

       

      NVL(SUM(WI.ROSTER_CNT), 0

      ) roster_cnt, territory_name

       

       



       

      FROM WEB_TRACK_APPTS WI,(SELECT distinct WRKEVNTID FROM WEB_TRACK_APPTS WHERE CLIENTID = '03'

       

       

       



       

      AND TRUNC(CRDT) >= TO_DATE('01/01/2010', 'MM/DD/YYYY'

      )

       

       



       

      AND TRUNC(CRDT) < TO_DATE(' 01/01/2011 ', 'MM/DD/YYYY'

      ))

       

       



       

      group by

      territory_name

       

      I have to display the roster_cnt in my straight table along with some other counts. Here we are doing the sum based on the distinct wrkevntid.

      I have the qvd file where i have taken all the values from my web_track_appts table . Now how should i give this distinct key in my expression and group by claue.

      any help will be appreciated.