Skip to content

Instantly share code, notes, and snippets.

@bartocc
Created November 26, 2010 13:44
Show Gist options
  • Save bartocc/716722 to your computer and use it in GitHub Desktop.
Save bartocc/716722 to your computer and use it in GitHub Desktop.
SELECT `products`.*
FROM `products`
INNER JOIN `distributions` ON `distributions`.`product_id` = `products`.`id`
WHERE (`distributions`.`product_id` IN (
SELECT `distributions`.`product_id`
FROM `distributions`
WHERE (`distributions`.`country_id` = 6)
AND (`distributions`.`active` = 1)
))
AND (`distributions`.`displayed_on_homepage` = 1)
group by `products`.`id`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment