Results 1 to 2 of 2

Thread: get sum

  1. #1
    Join Date
    Jul 2003
    Posts
    421

    get sum

    I have comp 1, comp2, hall 1 , hall2 , processStatus in table and inside processStatus colum I have valew a, b, c , aand b = successful and c = failed
    how can I get sum(successful) sum(failed) group by comp1, comp2, hall1, hall2
    Thank you!
    ________
    Lincoln ls history
    Last edited by sql; 03-06-2011 at 02:10 AM.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    select comp1, comp2, hall1, hall2 ,sum(case processstatus when 'successful' then 1 else 0 end case),
    sum(case processstatus when 'failed' then 1 else 0 end case),
    from t1
    group by comp1, comp2, hall1, hall2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •