問(wèn)題描述
SELECT * FROM people
WHERE
university='2'
AND MATCH (lname,fname) AGAINST ('+massive' IN BOOLEAN MODE)
OR (fname LIKE '%box%' OR lname LIKE '%box%')
此查詢?cè)试S過(guò)濾結(jié)果而不是 university='2'
我將如何更新它,以便它嚴(yán)格只顯示大學(xué) = 2 的結(jié)果
This query is allowing results to filter through other than those of university='2'
how would I update this so it strictly only shows results where university = 2
我將全文搜索與 LIKE 結(jié)合使用的原因是全文搜索的字母數(shù)最少,而且因?yàn)槲沂褂玫氖枪蚕碇鳈C(jī)計(jì)劃,所以我無(wú)法修改設(shè)置.因此,我將全文和 LIKE 結(jié)合起來(lái)以適應(yīng)
The reason I have combined fulltext search with LIKE is because of the minimum letter count that full text search has and because I am on a shared hosting plan I am unable to modify the settings. As a result I have combined both full text and LIKE in order to accommodate
推薦答案
修正括號(hào)
SELECT * FROM people
WHERE
university='2'
AND (MATCH (lname,fname) AGAINST ('+massive' IN BOOLEAN MODE)
OR fname LIKE '%box%'
OR lname LIKE '%box%')
AND
的優(yōu)先級(jí)高于 OR
,所以 university = '2'
只是與 MATCH
結(jié)合使用,而不是 fname/lname
測(cè)試.
AND
has higher precedence than OR
, so university = '2'
was only being combined with MATCH
, not with the fname/lname
tests.
這篇關(guān)于SQL 語(yǔ)句忽略了 where 參數(shù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!