Need help writing a query
Posted on 2008-10-17
Hi, I have 2 tables. Tabel A has an Id column and then 4 columns labed R1, R2, R3 and R4. I have another table B, I have and Id column and a Rid column. The B.id column could be have muliple records of the same id up to at most 4 rows.
I want to write the table B 's Rid it columns value to table A's Rn columns matching their A.id = B.id
Take the 1st match row from table B's Rid value and write it o table A's R1 column. If there is a 2nd match row then write the table B's Rid value and write it o table A's R2 column. Repeat until we runs out of the match.
Is it possible to write a query like this? Thank you.