clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 1716861 fiddles created (23921 in the last week).

WITH result_T AS ( SELECT 1 AS vocabId, 1 AS docId, 1000 AS count, 'plane' AS word UNION ALL SELECT 1, 3, 100, 'plane' UNION ALL SELECT 3, 1, 1200, 'motorbike' UNION ALL SELECT 3, 2, 702, 'motorbike' UNION ALL SELECT 3, 3, 600, 'motorbike' UNION ALL SELECT 5, 3, 2000, 'boat' UNION ALL SELECT 5, 2, 200, 'boat' ) SELECT r1.word, r2.word, COUNT(*) AS cnt FROM result_T r1 INNER JOIN result_T r2 ON r1.word < r2.word AND r1.docId = r2.docId GROUP BY r1.word, r2.word ORDER BY COUNT(*) DESC;
word word cnt
boat motorbike 2
motorbike plane 2
boat plane 1
 hidden batch(es)