sql 'is not' ( <> ) is not working

前端 未结 2 1386
遇见更好的自我
遇见更好的自我 2021-01-24 15:29

I have no idea what I do wrong... this is my code:

SELECT *
FROM messages
WHERE userId = \"6\"
OR toUserId = \"6\"
OR toAll = \"1\"
AND id <> \"4\"
ORDER          


        
2条回答
  •  春和景丽
    2021-01-24 16:20

    You need to use parenthesis to indicate operator precedence:

    WHERE (
           userId   = "6"
        OR toUserId = "6"
        OR toAll    = "1"
    )
    AND id <> "4"
    

提交回复
热议问题