mysql 查询显示错误
mysql query showing error
MySQL查询:-
SET \`products_id\`=(SELECT COALESCE(APR. \`productid\`,
BPR. \`productid\`,
CPR. \`productid\`,
DPR. \`productid\`,
EPR. \`productid\`,
'') as productid
FROM
\`gra\`.\`product\` AS APR
WHERE APR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`APR\`.\`manufacturerid\` = \`fgt\`.\`manufacturers_id\`
LEFT JOIN \`grb\`.\`product\` AS BPR
ON BPR.\`mfgpartno\` =\`csv_temp_table\`.\`products_mfg_part_no\` && \`BPR\`.\`manufacturerid\` =\`fgt\`.\`manufacturers_id\`
LEFT JOIN \`grc\`.\`product\` AS CPR
ON CPR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`CPR\`.\`manufacturerid\`=\`fgt\`.\`manufacturers_id\`
LEFT JOIN \`grd\`.\`product\` AS DPR
ON DPR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`DPR\`.\`manufacturerid\` =\`fgt\`.\`manufacturers_id\`
LEFT JOIN \`gre\`.\`product\` AS EPR
ON EPR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`EPR\`.\`manufacturerid\`=\`fgt\`.\`manufacturers_id\`) ;
如您所见,我正在五个不同的表格中搜索 product_id。
但是显示如下错误
ERROR 1064 (42000) at line 2: 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 'ON APR.mfgpartno
= csv_temp_table
.products_mfg_part_no
&& APR
.`manufactu' at line 64
过去几个小时我一直被困在这里。请帮我。谢谢
试试这个查询
SET @products_id=(SELECT COALESCE(APR.`productid`,
BPR.`productid`,
CPR.`productid`,
DPR.`productid`,
EPR.`productid`,
'') as productid
FROM
`gra`.`product` AS APR
LEFT JOIN `grb`.`product` AS BPR
ON BPR.`mfgpartno` =`csv_temp_table`.`products_mfg_part_no` && `BPR`.`manufacturerid` =`fgt`.`manufacturers_id`
LEFT JOIN `grc`.`product` AS CPR
ON CPR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `CPR`.`manufacturerid`=`fgt`.`manufacturers_id`
LEFT JOIN `grd`.`product` AS DPR
ON DPR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `DPR`.`manufacturerid` =`fgt`.`manufacturers_id`
LEFT JOIN `gre`.`product` AS EPR
ON EPR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `EPR`.`manufacturerid`=`fgt`.`manufacturers_id`
WHERE APR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `APR`.`manufacturerid` = `fgt`.`manufacturers_id`) ;
MySQL查询:-
SET \`products_id\`=(SELECT COALESCE(APR. \`productid\`,
BPR. \`productid\`,
CPR. \`productid\`,
DPR. \`productid\`,
EPR. \`productid\`,
'') as productid
FROM
\`gra\`.\`product\` AS APR
WHERE APR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`APR\`.\`manufacturerid\` = \`fgt\`.\`manufacturers_id\`
LEFT JOIN \`grb\`.\`product\` AS BPR
ON BPR.\`mfgpartno\` =\`csv_temp_table\`.\`products_mfg_part_no\` && \`BPR\`.\`manufacturerid\` =\`fgt\`.\`manufacturers_id\`
LEFT JOIN \`grc\`.\`product\` AS CPR
ON CPR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`CPR\`.\`manufacturerid\`=\`fgt\`.\`manufacturers_id\`
LEFT JOIN \`grd\`.\`product\` AS DPR
ON DPR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`DPR\`.\`manufacturerid\` =\`fgt\`.\`manufacturers_id\`
LEFT JOIN \`gre\`.\`product\` AS EPR
ON EPR.\`mfgpartno\` =\`fgt\`.\`products_mfg_part_no\` && \`EPR\`.\`manufacturerid\`=\`fgt\`.\`manufacturers_id\`) ;
如您所见,我正在五个不同的表格中搜索 product_id。 但是显示如下错误
ERROR 1064 (42000) at line 2: 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 'ON APR.
mfgpartno
=csv_temp_table
.products_mfg_part_no
&&APR
.`manufactu' at line 64
过去几个小时我一直被困在这里。请帮我。谢谢
试试这个查询
SET @products_id=(SELECT COALESCE(APR.`productid`,
BPR.`productid`,
CPR.`productid`,
DPR.`productid`,
EPR.`productid`,
'') as productid
FROM
`gra`.`product` AS APR
LEFT JOIN `grb`.`product` AS BPR
ON BPR.`mfgpartno` =`csv_temp_table`.`products_mfg_part_no` && `BPR`.`manufacturerid` =`fgt`.`manufacturers_id`
LEFT JOIN `grc`.`product` AS CPR
ON CPR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `CPR`.`manufacturerid`=`fgt`.`manufacturers_id`
LEFT JOIN `grd`.`product` AS DPR
ON DPR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `DPR`.`manufacturerid` =`fgt`.`manufacturers_id`
LEFT JOIN `gre`.`product` AS EPR
ON EPR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `EPR`.`manufacturerid`=`fgt`.`manufacturers_id`
WHERE APR.`mfgpartno` =`fgt`.`products_mfg_part_no` && `APR`.`manufacturerid` = `fgt`.`manufacturers_id`) ;