Skip to content

Instantly share code, notes, and snippets.

@bartocc
Created November 26, 2010 13:49
Show Gist options
  • Save bartocc/716732 to your computer and use it in GitHub Desktop.
Save bartocc/716732 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