我试图执行以下操作:
但出于某种原因,我无法得到我想要的结果。请参阅以下代码:
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
答案 0 :(得分:2)
将NOT
子句条件放在括号中。
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) )