2

I am using this query to update rows and get updated IDs. But after mysql update I am getting this 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)'". How can I rewrite my query so that it will be compatible with future mysql releases?

SET @ids_1012:=NULL;

WITH cte AS 
(SELECT a.id FROM a
INNER JOIN b ON a.sha1=b.sha1
WHERE state=0 
ORDER BY `a`.`priority` DESC LIMIT 16) 
UPDATE a
INNER JOIN cte USING(id)
SET state=1 
AND (SELECT @ids_1012:=CONCAT_WS(',', id, @ids_1012));

SELECT @ids_1012;
Caldur
  • 135
  • 10

1 Answers1

1

row_number() and rank() are the functions I wish someone would have told me about when I was trying to fix this MySQL Error.

[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)'.