The following is the query

select a,b,count(1) count from tbl group by a,b order by a,b

which will give the output like this

a b count
=============== ===============
18 A 16
18 B 6
18 C 7
18 D 9
19 A 16
19 B 6
19 C 7
19 D 9
17 A 16
17 B 6
17 C 7
17 D 9


But I want the output in...