Created
September 27, 2012 18:57
-
-
Save iso100/3795753 to your computer and use it in GitHub Desktop.
Filtering on multiple categories
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( cp.entry_id ) AS total_items, | |
cp.cat_id, | |
c.cat_name as category_name, | |
c.cat_url_title as category_url_title | |
FROM exp_weblog_titles AS wt | |
INNER JOIN exp_category_posts AS cp ON wt.entry_id = cp.entry_id | |
INNER JOIN exp_categories AS c ON cp.cat_id = c.cat_id | |
INNER JOIN exp_category_posts AS cp2 ON wt.entry_id = cp2.entry_id | |
INNER JOIN exp_categories AS c2 ON cp2.cat_id = c2.cat_id | |
WHERE wt.weblog_id = 57 | |
AND wt.status != 'closed' | |
AND c.site_id = 8 AND c2.site_id = 8 | |
AND c.group_id = 40 AND c2.cat_id = {segment_2_category_id} | |
GROUP BY c.cat_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment