Say I have this data in an 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 execute another request
select type,count(*) from table where status = 'closed'
a 2
c 1
How to write a query that shows me a table like this
type open closed
a 1 2
b 2 0
c 0 1
source share