我收到此错误消息:
SQLSTATE [42000]:语法错误或访问冲突:1064您有一个 您的SQL语法错误;检查与您的手册相对应的手册 在'WHERE c.id =附近使用正确语法的MySQL服务器版本 159 AND(supervisor_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
)
答案 0 :(得分:1)
问题是
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
)