I have a variable named status
in which there are values like:
- Expired
- No Interest
- Already Engaged
- Never Reached
- Non-Supported
- Market Nurture
I want to get count of all these.
Do I have to write manually like:
select
sum (case when a.[Status Reason] ='Expired' and a.status='Disqualififed' then 1 else 0 end ) as expired,
sum (case when a.[Status Reason] ='No interest' and a.status='Disqualififed' then 1 else 0 end ) as nointerst from lead
or is there any shortcut or some kind of automation possible or dynamic way so that i can avoid writing sql for each value?