consider
create table pairs (number a, number b)
where the data is
1,1
1,1
1,1
2,4
2,4
3,2
3,2
5,1
what query gives me all unique pairs plus a column representing the number of times that pair appeared. ie:
1,1,3
5,1,2
2,4,2
3,2,1
Note: This is SO question Distinct pair of values SQL but with the added "count" column requirement