在SQL中更新多行(phpMyAdmin)

时间:2018-02-08 18:31:04

标签: sql

我试图更新一个名为visit_date的列,其中id应该是propId,但似乎不可能在SQL phpMyAdmin中这样做。

我需要编辑总共500 000行,其中一些列在下面:

UPDATE `property_visit` SET (`propId`, `visit_date`) VALUES
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(89, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(118, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(109, '22-01-2018'),
(121, '22-01-2018');

1 个答案:

答案 0 :(得分:0)

你可以使用INSERT ... ON DUPLICATE KEY UPDATE,我假设你使用的是MySQL数据库。 类似于here

的说明