Solved

Need help writing a query

Posted on 2008-10-17
2
191 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
Comment Utility
"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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

15 Experts available now in Live!

Get 1:1 Help Now