Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
现在正在使用下面的代码通过 FTP 将 CSV 文件上传到 MYSQL 数据库。它工作正常。CSV 列有一个字段名称“状态”。它有两个值 A 和 D。但我想仅基于字段“状态”A 插入特定行。我如何插入这个?
LOAD DATA LOCAL INFILE '/root/782012_10.csv' INTO TABLE tbl_dndno FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
您可以将文件加载到临时表中,然后使用选择所需行的查询从临时表中插入主表。