Skip to content

Instantly share code, notes, and snippets.

@serenamm
Last active November 8, 2018 02:21
Show Gist options
  • Save serenamm/49d22effccea5a0cd23c52fc5416379f to your computer and use it in GitHub Desktop.
Save serenamm/49d22effccea5a0cd23c52fc5416379f to your computer and use it in GitHub Desktop.
SELECT
s.item_id_1,
s.item_id_2,
s.similarity_score
FROM product_similarity s
INNER JOIN products p
ON s.item_id_1 = p.item_id
INNER JOIN products q
ON s.item_id_2 = q.item_id
WHERE s.item_id_1 != s.item_id_2
AND p.category_id = q.category_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment