Hi there,
The following is a sample of my table
client_no type
================
1 dep
2 dep
1 dep
1 wth
2 dep
and i would like to group my data as
client_no dep wth
==================
1 2 1
2 2 0
How would I go about doing this??
I tried the following but i am not gettting the desired result
select
client_number,
case when type = 'dep' then count(distinct type) else 0 end as 'dep',
case when type = 'wth' then count(distinct type) else 0 end as 'wth'
from table
group by client_no,type
Ideally, I would like the sql to name the columns accordingly to the distinct 'type' int the table.
thanks
Start Free Trial