I need to display entries from Channel 1 and entries from (Channel 2, Category 1).

I'm guessing the meat of the query would be something like this:

WHERE channel_id = 1 OR (channel_id = 2 AND cat_id = 175)

And this is the full query I'm trying to use, which isn't working:

{exp:query sql='SELECT t.entry_id FROM exp_channel_titles left join exp_category_posts p on p.entry_id = t.entry_id WHERE channel_id = 88 OR (channel_id = 11 AND cat_id = 192) LIMIT 8'}{entry_id}{/exp:query}

This is the error I'm getting: "Unknown column 't.entry_id' in 'field list'"

1 Answer 1


You have defined p as alias for the posts table but you have not defined t as alias for the titles table.

FROM exp_channel_titles t

You'll also probably want to limit by status and by date (not expired, not future-posted).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.