MySql 高性能 Update 语句
2021-07-08 本文已影响0人
Messix_1102
UPDATE site
SET display_order = CASE id
WHEN 1 THEN 1
WHEN 2 THEN 2
WHEN 3 THEN 3
END,
name = CASE id
WHEN 1 THEN 'name 1'
WHEN 2 THEN 'name 2'
WHEN 3 THEN 'name 3'
END
WHERE id IN (1,2,3)
UPDATE site
SET display_order = CASE id
WHEN 1 THEN 1
WHEN 2 THEN 2
WHEN 3 THEN 3
END,
name = CASE id
WHEN 1 THEN 'name 1'
WHEN 2 THEN 'name 2'
WHEN 3 THEN 'name 3'
END
WHERE id IN (1,2,3)