Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SELECT `boats`.*
FROM `boats`
INNER JOIN `boat_classifications`
ON `boat_classifications`.`boat_id` = `boats`.`id`
INNER JOIN `classifications`
ON `classifications`.`id` = `boat_classifications`.`classification_id`
GROUP BY `boats`.`id`
HAVING count(classifications.id) = 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment