Skip to content

Instantly share code, notes, and snippets.

@stamaniorec
Last active October 31, 2015 11:57
Show Gist options
  • Select an option

  • Save stamaniorec/5461c59a33a326e24586 to your computer and use it in GitHub Desktop.

Select an option

Save stamaniorec/5461c59a33a326e24586 to your computer and use it in GitHub Desktop.
#sql #mosko
SELECT
COUNT(*)
FROM
(
SELECT
clubs.club_name, kids.name
FROM
clubs
INNER JOIN
kids_and_clubs
ON clubs.id = kids_and_clubs.club_id
INNER JOIN
kids
ON kids_and_clubs.kid_id = kids.id
ORDER BY
clubs.club_name
) AS derived
WHERE
derived.club_name = "History club";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment