I have two (My)SQL tables A, B. A has many columns A.(a,b,c,d...). B contains only two columns x,y. The number of rows in B is (much) less than that in A. All values in B.x are unique.
A is fully populated. In B only the values in B.x exist, B.y is empty and I want to fill B.y with the values from (say) A.b, corresponding to each value of B.x which appear as A.a
In other words, what I need to do is for each B.x find the match in A.a and take the corresponding A.b and insert it into B.y in the row containing the value of B.x. I then need to iterate this over all the values in B.x.
For reasons that we don't need to go into I need to do this in a single SQL statement; no PHP, no Python, etc. No embedding. What I am looking for is a way of making an iterated selection from one into the other. I also want to avoid the creation of temporary tables.
FWIW I can't make any assumptions about the number of rows in each table.
Hope that this is clear enough. Thanks for any help that you are able to give.