I have a query that captures the sum with multiple condition (see below), however, i would like to do the same thing but within a case statement if possible.
Original Query:
select
sum(Total Cost)
from Table
where date between '7/20/2016' and '7/21/2016'
and customer = "New Customer"
and sales like 's%'
I'm trying to put that in one case statement.
select
sum(case when total cost is not null then 1 else
case when customer = 'New Customer' then 1 else
case when sales like 's%' then 1 else
end end end
from table
where date between '7/20/2016' and '7/21/2016'
Thanks for the help