Here\'s the HQL:
select A, B, count(*) as cnt from test_table group by A, B order by cnt desc;
The sample output is as follows:
Try this query:
If you want only order of A then:
select A, B, count(*) as cnt from test_table group by A, B order by A asc;
If you want order of A and B then:
select A, B, count(*) as cnt from test_table group by A, B order by A asc,B asc;
Hope this helps.