Query Help

  • Hi there,
     
    I have subtotal1, subtotal2 columns in my table Test, I would like to sum(subtotal1) and sum(subtotal2) into one total based on the condition, if subtotal2=0 then sum(subtotal1) as total, if else then sum(subtotal2) as total, but all the sum need to return one total.
     
    Please give me some direction?
     
    Thanks
    Don
  • select sum( case when sub2 = 0 then sub1 else sub2 end)

    from ...

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply