替换所有行中的值

时间:2011-03-20 17:06:23

标签: mysql sql

我在表中有大约50条左右的记录,我需要一个sql语句来更新所有5到9的引用列id。如何将它应用于每个适用的记录?

3 个答案:

答案 0 :(得分:4)

UPDATE YourTable
SET referral_column_id = 9
WHERE referral_column_id = 5;

答案 1 :(得分:1)

UPDATE `table_name` SET `column_id` = 9 WHERE `column_id` = 5;

答案 2 :(得分:0)

UPDATE col SET referral = 9 WHERE referral =5