本文介绍了mysql更改列中的所有值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改表列"Quellendatum"中的所有值.

I want to change all values in the tablecolumn "Quellendatum".

当行值为2005-06-20时,应将其替换为2012-06-20.当行值为NULL或为空时,则应保持不变.

When the row-value is 2005-06-20 then it should be replaced with 2012-06-20.When the row-value is NULL or empty, then it should be untouched.

当前,我通过选择以下行对此进行手动修改:

Currently i modify this manually by selecting the row:

UPDATE  `outgoing2`.`tbl_hochschule` 
SET  `Quellendatum` =  '2012-06-20' 
WHERE  `tbl_hochschule`.`id` =1;

有没有办法自动执行此任务?

Is there a way to automate this task?

推荐答案

怎么样:

UPDATE outgoing2.tbl_hochschule 
SET Quellendatum = '2012-06-20' 
WHERE Quellendatum = '2005-06-20' 
AND !isnull( Quellendatum );

这篇关于mysql更改列中的所有值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 09:34