Solved

Need help writing a query

Posted on 2008-10-17
2
192 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

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 …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now