What I need is a query on a table that would return distinct combinations of columns A and B, along with the count of how many times each combination occurs in the table. This w
GROUP BY is your friend here:
select a,b,count(*) from test group by a,b order by a
SQLFiddle: http://sqlfiddle.com/#!9/062b0e/5
Use GROUP BY like this
GROUP BY
SELECT `A`, `B`, COUNT(*) AS `Count` FROM `table` GROUP BY `A`, `B` ORDER BY `A`