macrog
macrog

Reputation: 2105

mysql query - pairs of repeating numbers

I have a database with 2 columns (ex: no_1, no_2) and then 5000 rows of data, numbers are between 1 - 20 , I need to find a pairs of numbers which where repeating the most of the times?
Any help please ?

Upvotes: 0

Views: 38

Answers (1)

Kickstart
Kickstart

Reputation: 21513

Something like this maybe:-

SELECT no_1, no_2, COUNT(*) AS numbercount
FROM SomeTable
GROUP BY no_1, no_2
ORDER BY numbercount DESC

Upvotes: 1

Related Questions