我有一条SQL语句:
$sql =" SELECT DISTINCT
scr.*
FROM scr
LEFT JOIN `users` ON `users`.user_id=scr.user_id
WHERE $email_filter LOWER(scr.genre) LIKE '%$search_word_fix%' **HERE** $psez protage $wwc $prevoption $locatio $rats $rat1 $rat2 $rat3 $rat4
GROUP by scr.sp_name
ORDER BY scr.grade DESC";
当我在“HERE”中添加'%$ search_word_fix%'之类的较低(scr.classification)时 它没有显示正确的结果。 我在想(比如scr.genre =“searchkeyword”和其他过滤器)或者(其中scr.classification =“searchkeyword”和其他过滤器)
答案 0 :(得分:7)
仅指定一次。附加条款仅使用“或”和“和”
指定使用parans对操作顺序进行分组
where (scr.genre = "searchkeyword" and other filters here)
OR (scr.classification ="searchkeyword" and other filters here)