sql setting xml property through a loop -
trying desperately combine 2 simple answers need. sql loop , set properties sql set xml value set @i := 0; select *, @i := @i + 1 set xml = updatexml(xml,'comic/pagenumber', '<pagenumber>'.@i.'</pagenumber>') `comics` order extractvalue(xml,'comic/pagenumber')+100000 asc this close have come, know select / order works separate trying set xml property. side note: +100000 work around treat value numeric sorting. otherwise 11 < 2 100011 > 100002 i have tried this set @i := 0; update comics, @i := @i + 1 newpagenumber set xml = updatexml(xml,'comic/pagenumber', '<pagenumber>'.@i.'</pagenumber>') 1 order extractvalue(xml,'comic/pagenumber')+100000 asc i think don't know how combine select , update update comics inner join ( select c.id, @row:=@row+1 rownum (select @row:=0) x cross join comics c order extractvalue(xml,'comic/pagenumber')*1....