mysql更改列中的所有值

时间:2021-04-09 07:57:32

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

我想更改表格列“Quellendatum”中的所有值。

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.

当行值为2005-06-20时,应将其替换为2012-06-20。当行值为NULL或为空时,它应该是不变的。

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?

有没有办法自动完成这项任务?

4 个解决方案

#1


24  

How about:

怎么样:

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

#2


5  

In MySql

在MySql中

UPDATE TABLENAME    
SET IDCOLUMN=VALUE    
WHERE IDCOLUMN=VALUE    
AND !isnull (IDCOLUMN)

This works in Mysql.

这适用于Mysql。

#3


1  

it should be :

它应该是 :

UPDATE tablename 
SET Quellendatum = '2012-06-20' 
WHERE Quellendatum = '2005-06-20'

#4


1  

UPDATE outgoing2.tbl_hochschule 
SET Quellendatum = '2012-06-20' 
WHERE Quellendatum <> '' AND Quellendatum <> NULL;

#1


24  

How about:

怎么样:

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

#2


5  

In MySql

在MySql中

UPDATE TABLENAME    
SET IDCOLUMN=VALUE    
WHERE IDCOLUMN=VALUE    
AND !isnull (IDCOLUMN)

This works in Mysql.

这适用于Mysql。

#3


1  

it should be :

它应该是 :

UPDATE tablename 
SET Quellendatum = '2012-06-20' 
WHERE Quellendatum = '2005-06-20'

#4


1  

UPDATE outgoing2.tbl_hochschule 
SET Quellendatum = '2012-06-20' 
WHERE Quellendatum <> '' AND Quellendatum <> NULL;