在使用update
语句的时候我们有时候需要利用left join
关联表,以下是正确操作:
order
表id
为1,2,3数据的finish_at
字段更新为freports
表的created_at
字段 UPDATE ordersLEFT JOIN freportsON freports.order_id = orders.id set orders.finish_at = freports.created_at where orders.id in(1,2,3) mysql导出csv: select * from table into outfile '/Users/k/Desktop/task.csv' fields terminated by ','; csv导入mysql:
load data local infile '/Users/k/Desktop/task.csv' into table t_name
fields terminated by ','
(col1,col2,col3);