Created
March 29, 2012 14:17
-
-
Save objectivehtml/2237902 to your computer and use it in GitHub Desktop.
Return channel entries with all the categories grouped in a single category
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 GROUP_CONCAT(CONVERT(CONCAT(',', `exp_category_posts`.`cat_id`), CHAR(8)) SEPARATOR ' ') as `category_ids` | |
FROM `exp_channel_data` | |
LEFT JOIN `exp_category_posts` ON `exp_channel_data`.`entry_id` = `exp_category_posts`.`entry_id` | |
LEFT JOIN `exp_channel_titles` ON `exp_channel_data`.`entry_id` = `exp_channel_titles`.`entry_id` | |
GROUP BY `exp_channel_data`.`entry_id` | |
HAVING `category_ids` LIKE '%,10 %' AND `category_ids` LIKE '%,1 %' | |
LIMIT 0 , 30 |
adrienne
commented
Mar 29, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment