这是我的搜索框的SQL代码(表包含M和F的排名),我想只获取M的数据:
"SELECT *
FROM players WHERE gender = 'M' AND
name LIKE '%{$keywords}%'
OR surname LIKE '%{$keywords}%'
";
我试图获得男性(M)
的玩家的价值观因此,性别是M是重要的,但对于第二和第三个WHERE子句,我想要放置OR
答案 0 :(得分:1)
"SELECT *
FROM players WHERE gender = 'M' AND
( name LIKE '%{$keywords}%'
OR surname LIKE '%{$keywords}%')
";