Skip to content

Instantly share code, notes, and snippets.

@gabidavila
Created August 8, 2017 13:57
Show Gist options
  • Save gabidavila/c56f0073cec625bc3785271a006a25f8 to your computer and use it in GitHub Desktop.
Save gabidavila/c56f0073cec625bc3785271a006a25f8 to your computer and use it in GitHub Desktop.
SELECT
`captains`.*
FROM
`captains`
INNER JOIN
`boats` ON `boats`.`captain_id` = `captains`.`id`
INNER JOIN
`boat_classifications` ON `boat_classifications`.`boat_id` = `boats`.`id`
INNER JOIN
`classifications` ON `classifications`.`id` = `boat_classifications`.`classification_id`
WHERE
`classifications`.`name` = 'Sailboat'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment