I have a table with three fields – userID, couponID, latest_couponID. For the last two fields, there could be pairs such as 1 & 3, 5 & 9, 10 & 3, just for example. I’m trying to find the most common pairs, and the amount of occurrences, and list them in order. How can I do that?
I have a table with three fields – userID, couponID, latest_couponID. For the last
Share
select couponID, latest_couponID, count(*) as occurances from your_table group by couponID, latest_couponID ORDER BY occurances DESC;