Skip to content

Instantly share code, notes, and snippets.

@oleander
Created April 22, 2011 20:04
Show Gist options
  • Save oleander/937478 to your computer and use it in GitHub Desktop.
Save oleander/937478 to your computer and use it in GitHub Desktop.
SELECT DISTINCT movies.id, movies.title, images.url as poster
FROM `movies`
INNER JOIN `images` ON `images`.`movie_id` = `movies`.`id`
INNER JOIN `sizes` ON `sizes`.`id` = `images`.`size_id`
WHERE `movies`.`active` = 1 AND
(sizes.name = 'cover')
GROUP BY movies.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment