GROUP BY ist hier Ihr Freund:
select a,b,count(*) from test
group by a,b
order by a
SQLFiddle:http://sqlfiddle.com/#!9/062b0e/5
GROUP BY ist hier Ihr Freund:
select a,b,count(*) from test
group by a,b
order by a
SQLFiddle:http://sqlfiddle.com/#!9/062b0e/5