I use this query to rewrite the id number column by date, after a new row is added to the database. Even if the query runs well I can't fix the error displayed at the end of the query. Any suggestion?
SET @ROW = 0;
UPDATE `mytable` SET `id` = @ROW := @ROW+1 ORDER BY `date` ASC;
Warning: #1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
I tried to modify the query
set id = "0";
UPDATE `mytable` SET := id+1 ORDER BY `data` ASC;
with no success.