在 MySQL 表中mytable
我想更新列max_value
查询前的示例表如下所示:
___________________________________________________
|| id || value1 || value2 || value3 || max_value ||
___________________________________________________
|| 1 || 1 || 2 || 3 || NULL ||
===================================================
|| 2 || 99 || 2 || 3 || NULL ||
===================================================
|| 3 || 1 || 66 || 66 || NULL ||
===================================================
|| 4 || 1 || 2 || NULL || NULL ||
===================================================
|| 5 || NULL || NULL || NULL || NULL ||
___________________________________________________
之后 SQL 语句应该已经更新为,或max_value
的最大值。像这样:value1
value2
value3
___________________________________________________
|| id || value1 || value2 || value3 || max_value ||
___________________________________________________
|| 1 || 1 || 2 || 3 || 3 ||
===================================================
|| 2 || 99 || 2 || 3 || 99 ||
===================================================
|| 3 || 1 || 66 || 66 || 66 ||
===================================================
|| 4 || 1 || 2 || NULL || 2 ||
===================================================
|| 5 || NULL || NULL || NULL || NULL ||
___________________________________________________
谁能给我一个 MySQL 查询?