Results 1 to 5 of 5
Apr 15, 2013, 01:06 #1
- Join Date
- Jun 2007
- 0 Post(s)
- 0 Thread(s)
Selectively applying user ID in WHERE clause to entries
I been going back and forth with IF and CASE and a whole lot of other suggestions found elsewhere trying to figure out how to filter out certain entries based on category and user ID. Assume that a table `user_posts` contains posts made by a lot of users. I want to get results restricted to the `user_ID`='MIRA76' for posts that are in categories 'CAT_64' or 'CAT_106'. However, I still want to get results by other users from other categories.
post_ID category_ID user_ID content 456FQ CAT_64 MEK90 TEXTUAL CONTENT 754GD CAT_21 MEK90 TEXTUAL CONTENT 616CZ CAT_106 MIRA76 TEXTUAL CONTENT 714PA CAT_64 MIRA76 TEXTUAL CONTENT 554WU CAT_26 RON32 TEXTUAL CONTENT 451YD CAT_41 RON32 TEXTUAL CONTENT 783TD CAT_21 MIRA76 TEXTUAL CONTENT 156GL CAT_11 MEK90 TEXTUAL CONTENT 274HD CAT_11 HOM92 TEXTUAL CONTENT
In the example entries, for categories 'CAT_64' and 'CAT_106' only those by the `user_ID` 'MIRA76' is taken, but for other categories there is no such restriction. How do I go about doing this? Here those in green highlight are the ideal results.