?
Solved

Need help writing a query

Posted on 2008-10-17
2
Medium Priority
?
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

765 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