We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to select entries with exclusive category

Development and Programming

Larry Lane's avatar
Larry Lane
2 posts
15 years ago
Larry Lane's avatar Larry Lane

Let’s say I’ve got the following scenario

entry 228 is related to category 126,127,128,129 entry 229 is related to category 126 the client wants to show 229 in an exclusive category 126 list

I can’t seem to get EE entries tag to return the right value. What SQL query would get me 229 alone where cat_id = 126?

       
Larry Lane's avatar
Larry Lane
2 posts
15 years ago
Larry Lane's avatar Larry Lane

I figured this out. Maybe will help someone else along the way.

Select e.entry_id as entry from exp_channel_data e inner join (select count(exp_category_posts.entry_id) as thecount, entry_id from exp_category_posts where cat_id <>125 group by exp_category_posts.entry_id) a on e.entry_id = a.entry_id where a.thecount = 3 AND e.channel_id = 17 order by e.field_id_64 asc;

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.