谢谢你看我的问题。我正在尝试将多个表的3列连接在一起,然后找到与like请求匹配的nameproduct列。所有表都有不同的列,看起来就像3列:name、id和rate。这是我的密码:
(
SELECT
nameProduct,
rate,
idProduct
FROM
tblaptoplist
)
UNION
(
SELECT
nameProduct,
rate,
idProduct
FROM
tbcpulist
)
UNION
(
SELECT
nameProduct,
rate,
idProduct
FROM
tbgraphicslist
)
UNION
(
SELECT
nameProduct,
rate,
idProduct
FROM
tbpccaselist
)
UNION
(
SELECT
nameProduct,
rate,
idProduct
FROM
tbradiatorslist
)
UNION
(
SELECT
nameProduct,
rate,
idProduct
FROM
tbramlist
)WHERE nameProduct LIKE 'Asus'
;
mysql被报道:
# 1064 - 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 'WHERE
nameProduct LIKE 'Asus' LIMIT 0, 25' at line 54
我做错什么了?请帮帮我
1条答案
按热度按时间vsaztqbk1#
你不能申请
WHERE
结果UNION
直接。您可以在“选择”中为每个子选择或并集的换行结果筛选查询: