Reputation: 1561
I'm trying to do the following:
But for some reason I don't get the results I want. See my following code:
SELECT *, MONTH(datetime) AS month
FROM $table_name
WHERE YEAR(datetime) = $current_year
AND find_in_set('%$user_id%', users)
AND NOT find_in_set('%$user_id%', accepted) OR NOT find_in_set('%$user_id%', rejected)
ORDER BY datetime
Upvotes: 1
Views: 1300
Reputation: 24012
Put the NOT
clause condition in parenthesis.
WHERE YEAR(datetime) = $current_year
AND find_in_set('%$user_id%', users)
AND ( NOT find_in_set('%$user_id%', accepted)
OR NOT find_in_set('%$user_id%', rejected) )
Upvotes: 2