SELECT p1.name prod1,p2.name prod2,COUNT(*) freq FROM transaction_sell_lines t1 JOIN transaction_sell_lines t2 ON t1.transaction_id=t2.transaction_id JOIN products p1 ON t1.product_id=p1.id JOIN products p2 ON t2.product_id=p2.id WHERE t1.product_id<t2.product_id GROUP BY p1.id,p2.id,p1.name,p2.name HAVING freq>5 ORDER BY freq DESC;