This is a continuation from a post that I mistakenly put in Tech Support
Essentially I’m looking to do this:
{exp:channel:entries channel="events" category="7&(175|177)"}I realise that the combo logic in the category parameter isn’t standard, and I’ve been trying to write a sql query to achieve the above, but I think I’m doing it wrong as single entries can have multiple category_post entries (as many as the categories they’re assigned to). So I’m not sure if this is achievable with the query module either, or whether I need to beak into php, or what…
Here’s what I’ve written:
<ul>
{exp:query sql="SELECT
type.cat_id,
type.cat_name as cat_name,
type.cat_url_title,
type.group_id,
t.title as title,
t.status,
t.channel_id,
t.site_id,
d.field_id_32 as date,
p.cat_id as cat_id
FROM
exp_categories type JOIN
exp_category_posts p ON type.cat_id = p.cat_id JOIN
exp_channel_titles t ON p.entry_id = t.entry_id JOIN
exp_channel_data d ON t.entry_id = d.entry_id
WHERE
t.status = 'open' AND
t.site_id = 1 AND
type.group_id = 2 AND
/* PROBLEM LINE FOLLOWS! */
(p.cat_id = 7 AND ((p.cat_id = 175) OR (p.cat_id = 177))) AND
/* PROBLEM LINE ENDS */
t.channel_id = 3
GROUP BY
type.cat_id
ORDER BY
type.cat_order
LIMIT 5"}
{if no_results}<li>Sorry, we don't have any events listed</li>{/if}
<li>{date} {title} {cat_name} {cat_id}</li>
{/exp:query}
</ul>Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.