嗨,人们正在尝试将记录列表放入一个表中,以实现我正在为网站执行的搜索功能
3个表格,1个页面信息,1个项目,1个最新消息。
但是,我的查询出现错误,我看不出它有什么问题。
SELECT 'section' AS colTYPE, title_sec AS title,
CONCAT_WS(' ',contentcol1_sec, contentcol2_sec, contentcol3_sec) AS content,
active_sec AS active
FROM sections_sec
WHERE content LIKE 'fff' OR title LIKE 'fff' AND active = 1)
UNION(SELECT 'latest' AS colTYPE, title_lat AS title,
content_lat AS content, active_lat AS active
FROM latest_lat
WHERE content LIKE 'fff' OR title LIKE 'fff' AND active = 1)
UNION(SELECT 'project' AS colTYPE, title_prj AS title,
content_prj AS content, active_prj AS active
FROM projects_prj
WHERE content LIKE 'fff' OR title LIKE 'fff' AND active = 1)
我收到的错误是:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ')
UNION(SELECT 'latest' AS colTYPE, title_lat AS title,
content_lat AS conten' at line 3