I have a table A and there is one primary key ID.
Now I want to go through all rows in A.
I found something like 'for each record in A', but this seems to be not how you do it in MySQL.
Thing is for each row I want to take a field and transform it, insert it into another table and then update some of the row's fields. I can put the select part and the insert into one statement, but I don't know how to get the update in there as well. So I want to loop. And for practice I don't want to use anything else than MySQL.
edit
I would appreciate an example.
And a solution which does not need to be put into a procedure.
edit 2
okay think of this scenario:
Table A and B, each with fields ID and VAL.
Now this is the pseudo code for what I want to do:
for(each row in A as rowA)
{
insert into B(ID, VAL) values(rowA[ID], rowA[VAL]);
}
basically copying content of A into B using a loop.
(this is just a simplified example, of course you wouldn't use a loop for this.) }