How can I use user defined variables in a MySql update statement? By user defined variables, i'm referring to the @v:=.
The statement below works fine without the user defined variables, but not with them.
update amga a left join amgb b on a.itemTempId = b.itemTempId
set @i:= concat(a.itemCountry,'-',a.id), a.itemId = @i, b.itemId = @i
where a.itemId is null or b.itemId is null;
I'll be using this with php PDO later.
This works, but does use user defined variables
update amga a left join amgb b on a.itemTempId = b.itemTempId
set a.itemId = concat(a.itemCountry,'-',a.id), b.itemId = concat(a.itemCountry,'-',a.id)
where a.itemId is null or b.itemId is null;