SQL statement is ignoring where parameter

前端 未结 1 1910
既然无缘
既然无缘 2020-11-22 09:15
SELECT * FROM people 
WHERE
university=\'2\' 
AND MATCH (lname,fname) AGAINST (\'+massive\' IN BOOLEAN MODE) 
OR (fname LIKE \'%box%\' OR lname LIKE \'%box%\') 


        
相关标签:
1条回答
  • 2020-11-22 09:33

    Fix your parentheses

    SELECT * FROM people 
    WHERE
        university='2' 
        AND (MATCH (lname,fname) AGAINST ('+massive' IN BOOLEAN MODE) 
             OR fname LIKE '%box%' 
             OR lname LIKE '%box%') 
    

    AND has higher precedence than OR, so university = '2' was only being combined with MATCH, not with the fname/lname tests.

    0 讨论(0)
提交回复
热议问题