[Solved] How to make SQL Script like this? [closed]


You can try like following using GROUP BY and UNION ALL.

select  count(*) CT,Mark
from TableName
group by Mark
union all
select Count(*), 'A+B' as mark
from TableName
where mark in('A','B')
UNION ALL
select Count(*), 'A+C' as mark
from TableName
where mark in('A','C')
union all
select Count(*), 'B+C' as mark
from TableName
where mark in('B','C')
UNION ALL
select Count(*), 'A+B+C' as mark
from TableName

solved How to make SQL Script like this? [closed]