Skip to content

Instantly share code, notes, and snippets.

@oleander
Created May 5, 2010 20:04
Show Gist options
  • Save oleander/391350 to your computer and use it in GitHub Desktop.
Save oleander/391350 to your computer and use it in GitHub Desktop.
SELECT gigs.id, gigs.channel_id
FROM
`gigs`
JOIN(
SELECT gigs.id,COUNT(gigs.channel_id) as theCount
FROM `gigs`
LEFT OUTER JOIN `songs` ON `songs`.`id` = `gigs`.`song_id`
HAVING theCount < 5
ORDER BY gigs.channel_id )
AS dt USING (gigs.channel_id);
The following errors were reported:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.channel_id)' at line 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment