使用where match with where子句

oogrdqng  于 2021-06-17  发布在  Mysql
关注(0)|答案(1)|浏览(276)

我收到以下错误消息:
sqlstate[42000]:语法错误或访问冲突:1064您的sql语法有错误;查看与您的mysql服务器版本相对应的手册,以获取在“where c.id=159 and(supervisor\u agent.superviso)”附近使用的正确语法
拜托,我还缺什么?当我删除以下内容时,一切正常:

AND WHERE c.id = 159 AND  
(
supervisor_agent.supervisor_id = 5
OR
ind.agent_id = 5
)

从下面的查询;

SELECT

'individual' AS type, ind.id, ind.uid, CONCAT_WS(' ', ind.last_name, ind.first_name, ind.middle_name) AS title, NULL AS phone, c.name AS country, s.name AS state, l.name AS lga, MATCH (ind.uid,ind.tin,ind.email,ind.first_name,ind.last_name,ind.middle_name,ind.maiden_name,ind.gender,ind.marital_status) AGAINST ('+mbah*' IN BOOLEAN MODE) AS score 

FROM individuals AS ind

LEFT JOIN supervisor_agent ON ind.agent_id = supervisor_agent.agent_id LEFT JOIN countries AS c ON ind.country_origin_id = c.id LEFT JOIN states AS s ON ind.state_origin_id = s.id LEFT JOIN lgas AS l ON ind.lga_origin_id = l.id 

WHERE MATCH (uid,tin,email,first_name,last_name,middle_name,maiden_name,gender,marital_status) AGAINST ('+mbah*' IN BOOLEAN MODE) AND WHERE c.id = 159 AND  
(
supervisor_agent.supervisor_id = 5
OR
ind.agent_id = 5
)
ipakzgxi

ipakzgxi1#

问题是

AND WHERE ...

只是放 AND ```
SELECT

'individual' AS type, ind.id, ind.uid, CONCAT_WS(' ', ind.last_name, ind.first_name, ind.middle_name) AS title, NULL AS phone, c.name AS country, s.name AS state, l.name AS lga, MATCH (ind.uid,ind.tin,ind.email,ind.first_name,ind.last_name,ind.middle_name,ind.maiden_name,ind.gender,ind.marital_status) AGAINST ('+mbah*' IN BOOLEAN MODE) AS score

FROM individuals AS ind

LEFT JOIN supervisor_agent ON ind.agent_id = supervisor_agent.agent_id LEFT JOIN countries AS c ON ind.country_origin_id = c.id LEFT JOIN states AS s ON ind.state_origin_id = s.id LEFT JOIN lgas AS l ON ind.lga_origin_id = l.id

WHERE MATCH (uid,tin,email,first_name,last_name,middle_name,maiden_name,gender,marital_status) AGAINST ('+mbah*' IN BOOLEAN MODE)
AND c.id = 159 AND
(
supervisor_agent.supervisor_id = 5
OR
ind.agent_id = 5
)

相关问题