I want to assign values to null cells of a column as
UPDATE table 1
SET number = MAX(number) + 1
WHERE number IS NULL
but mysql return error Invalid use of group function
.
maxMySQLupdate
I want to assign values to null cells of a column as
UPDATE table 1
SET number = MAX(number) + 1
WHERE number IS NULL
but mysql return error Invalid use of group function
.
Best Answer
Assuming that you want - if the
max(number)
in the whole table is say, 27 - to update all the rows with NULL, to 28.You need a subquery or a derived table to first find this max and then join back to the table: