Let’s say I have this data in a MSSQL table
type status a open b open a closed a closed a closed b open c closed
I can run this query to get a table like this
select type,count(*) from table where status = 'open'
a 1 b 2
Then I can do another query
select type,count(*) from table where status = 'closed'
a 2 c 1
How do I write a query that shows me a table like this
type open closed a 1 2 b 2 0 c 0 1
This will produce your desired result