Solved

Need help writing a query

Posted on 2008-10-17
2
194 Views
Last Modified: 2010-03-20
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.
0
Comment
Question by:lapucca
2 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 500 total points
ID: 22746932
"Take the 1st match row from table B's Rid "

What do you want to determine the FIRST column?  Is there anther field to order by?  Also, if you provide your column/table names it would be easier, this may get a tiny bit complex so it may be easier for me to just write it.
0
 

Author Comment

by:lapucca
ID: 22746970
I realize that it would be just easier if I just write this in C# since I'm not so familiar with SQL now, and I'm done but am debugging the code.  Thank you very much.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

As they say in love and is true in SQL: you can sum some Data some of the time, but you can't always aggregate all Data all the time! Introduction: By the end of this Article it is my intention to bring the meaning and value of the above quote to…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question