[Solved] SQL and Counting

Give this a try: select name, count(case when grade in (‘A’, ‘B’, ‘C’) then 1 end) totalPass, count(case when grade=”A” then 1 end) totalA, count(case when grade=”B” then 1 end) totalB, count(case when grade=”C” then 1 end) totalC from t group by name Here is the fiddle. Or we can make it even simpler if … Read more