I want to take values from a column in one table and put them into a column in another table. There is no relationship between the tables so no join can be done. I just want to go one by one through the values in table1 and put them into particular cells (that contain a value of 9999) of another column in another table. I was thinking of some kind of loop like below but not sure exactly how to go about that.
You'd have to get all the values of table1 and loop through them, and then find the first instance of col2 where col2 = 9999 and then put the first value of col1 in, then put the second value of col1 into the second instance of col2 where col2 = 9999 and so on.
what's the best way to do that?
FOR val IN (SELECT col1 FROM table1)
SET col2 = val
WHERE col2 = 9999;