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;