Skip to content

Instantly share code, notes, and snippets.

@brecert
Created June 23, 2022 05:15
Show Gist options
  • Save brecert/c555e79b02f6fa571344cb5ce9340f3a to your computer and use it in GitHub Desktop.
Save brecert/c555e79b02f6fa571344cb5ce9340f3a to your computer and use it in GitHub Desktop.
SELECT
item.id,
item.name,
item.description
FROM
item,
tag
INNER JOIN itemtaglink ON
itemtaglink.item_id = item.id AND
itemtaglink.tag_id = tag.id
GROUP BY
item.id
HAVING
count(*) FILTER (WHERE tag.name = "sharpness" OR tag.name = "pickaxe" OR tag.name = "wooden") >= 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment