Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 从多个和/或新的.CSV文件简单更新表_Mysql_Csv - Fatal编程技术网

Mysql 从多个和/或新的.CSV文件简单更新表

Mysql 从多个和/或新的.CSV文件简单更新表,mysql,csv,Mysql,Csv,编辑,因为它被认为太长了 我有一个从.CSV导入的表“customerdetails”,并希望使用具有相同结构的新.CSV文件“newcustomerrecords”对其进行更新 下面是我使用的代码,它失败了,错误代码为1290 CREATE TEMPORARY TABLE temp_table LIKE customerdetails; LOAD DATA INFILE 'C:/Documents/MySQL Test Databases/newcustomerdetails2020.cs

编辑,因为它被认为太长了

我有一个从.CSV导入的表“customerdetails”,并希望使用具有相同结构的新.CSV文件“newcustomerrecords”对其进行更新

下面是我使用的代码,它失败了,错误代码为1290


CREATE TEMPORARY TABLE temp_table LIKE customerdetails;

LOAD DATA INFILE 'C:/Documents/MySQL Test Databases/newcustomerdetails2020.csv'
INTO TABLE temp_table
FIELDS terminated by ','
(customer_ID, first_name, last_name, membership_id, email_address);

UPDATE customerdetails
INNER JOIN temp_table Customer_ID ON temp_table.customer_ID = customerdetails.customer_ID
SET customerdetails.Customer_ID = temp_table.Customer_ID;```

How do I

a: update customerrecords from newcustomerrecords
b: fix the 1290 error

Thanks

请阅读并关注:使用不同的名称(第一个文件名为customerdetails,第二个文件名为customerdetails220920)以及现在的代码。MySQL绝对没有与文件系统一起工作的工具。MySQL可能会定期尝试将文件中的数据加载到临时或静态中间表中,该文件具有一定的名称(可能是常量,也可能是根据某些数据构建/计算的,例如,从当前日期)。如果加载成功,则可通过通用方式处理来自该中间表的数据,并用于更新工作表中的数据。