Viewing post 1 (of 1 total)
How about using bitwise checking?
select customerid,
sum(distinct case
when productcode='A' then 1
when productcode='B' then 2
when productcode='C' then 4
else 0 end)
from #purchase
group by customerid
having sum(distinct case
when...
June 6, 2014 at 10:19 pm
#1719890