我正在运行以下查询:
CREATE TEMPORARY TABLE data LIKE customers;
LOAD DATA INFILE 'D:/iban.csv'
INTO TABLE data
FIELDS TERMINATED BY ','
(customers_id, customers_banktransfer_iban, customers_banktransfer_bic);
UPDATE data B
INNER JOIN customers A USING (customers_id)
SET A.customers_id = B.customers_id;
SET A.customers_banktransfer_iban = B.customers_banktransfer_iban;
SET A.customers_banktransfer_bic = B.customers_banktransfer_bic;
DROP TEMPORARY TABLE data;
我得到的错误信息是:
#1193 - Unknown system variable 'customers_banktransfer_iban'
有谁知道问题是什么?
答案 0 :(得分:1)
您的更新查询应如下所示:
UPDATE data B
INNER JOIN customers A USING (customers_id)
SET A.customers_id = B.customers_id,
A.customers_banktransfer_iban = B.customers_banktransfer_iban,
A.customers_banktransfer_bic = B.customers_banktransfer_bic;
否则,您正在尝试为尚未声明的变量赋值。