MySQL查询: -
IDWriteTextLayout
正如您所看到的,我正在为product_id搜索五个不同的表。 但它显示以下错误
第2行的错误1064(42000):您的SQL语法出错;查看与您的MySQL服务器版本相对应的手册,以便在APR附近使用正确的语法。
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\`) ;
=mfgpartno
。csv_temp_table
&& 。products_mfg_part_no
`manufactu'在第64行
过去几个小时我一直被困在这里。请帮我。感谢
答案 0 :(得分:1)
尝试此查询
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`) ;