Created
June 18, 2013 15:23
-
-
Save damour/5806293 to your computer and use it in GitHub Desktop.
sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT COUNT(*) | |
| FROM ( | |
| SELECT `pf`.`product_id` | |
| FROM `products` `p` | |
| JOIN `products_feature` `pf` ON p.product_id = pf.product_id | |
| WHERE | |
| p.`category_id` = 151 AND | |
| (pf.feature_id=5 AND (`value` IN ('1600'))) | |
| OR | |
| (pf.feature_id=6 AND `value` IN ('1024', '2048')) | |
| GROUP BY `pf`.`product_id` | |
| HAVING COUNT(pf.product_id) = 2 | |
| ) AS X |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment