Skip to content

Instantly share code, notes, and snippets.

@xenda
Created May 25, 2012 21:57
Show Gist options
  • Save xenda/2790825 to your computer and use it in GitHub Desktop.
Save xenda/2790825 to your computer and use it in GitHub Desktop.
SELECT COUNT(*) FROM `products` INNER JOIN `product_variants` ON `product_variants`.`product_id` = products.`id` INNER JOIN `stores` ON `stores`.`id` = products.`store_id` WHERE ((stores.ruc_rus IS NOT NULL and stores.ruc_rus != '') AND (stores.trade_name IS NOT NULL and stores.trade_name != '') AND (stores.cci IS NOT NULL and stores.cci != '') AND (stores.warranty_policies IS NOT NULL and stores.warranty_policies != '')) HAVING ((select count(*) from product_variants join products on product_variants.product_id = products.id where `product_variants`.product_id = products.id) > 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment