I wasn't sure how best to phrase the title and I'm normally intuitive enough to figure these things out but I'm stumped by this problem so I'll explain it. This is my query:
(SELECT COUNT(flagger_member_id) FROM flags WHERE flagged_post_id = posts.id) AS flag_count
FROM posts WHERE post_type NOT LIKE 1
AND ( (author_ip NOT IN ( '220.127.116.11' ) AND author_id = 0 )
ORDER BY posts.id DESC LIMIT 0 , 8
The bold AND query is where I'm having trouble (it's obviously incorrect) but my idea is for the query to return all rows where the author_ip is not in the specified ranges (this works elegantly by itself), but also for that conditional to ONLY happen when the author_id is 0 (one conditional relying on the other).
So for example:
author_ip -> 18.104.22.168 : author_id -> 1 = would be returned
author_ip -> 22.214.171.124 : author_id -> 1 = would be returned
author_ip -> 126.96.36.199 : author_id -> 0 = would not be returned
Is there any way to write this query to perform the way I want it to? Is there perhaps something I'm not seeing here? I'd appreciate any help I can get.. I'm not an expert on MYSQL, just a hobbyist so if there's something I can learn about where I'm screwing up, I'd be glad for the pointers!