[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How do I select data that is in Two different table...

Posted on 2007-11-27
4
Medium Priority
?
227 Views
Last Modified: 2010-04-21
I need a help on SQL query in MS SQL 2005

I have two tables with this column below:
Member(Table): MemberID, LastName, FirstName
Board(Table): BoardID, CreatorMemberID, EscalatedMemberID, CompletedMemberID

CreatorMemberID, EscalatedMemberID, CompletedMemberID has MemberID value that is Constraint Foriegn Key with Member Table's MemberID.

Here is my question.
How do I make query that will select CreatorMember's First & Last Name, EscalatedMember's First & Name , and CompletedMember's First & Last Name?

If I need to select  CreatorMember's First & LastName, I know how to do it by using JOIN, but how do I use JOIN to bring all of their firstname, and lastname.

Thank you.
0
Comment
Question by:erin027
[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
4 Comments
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20363400
like the select statement which you use to CreatorMember in the same way create for others too and have UNION between all three select statements
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 total points
ID: 20363407
or 3 joins:


I have two tables with this column below:
Member(Table): MemberID, LastName, FirstName 
 select b.boardid, cr.lastname Creator_lastname, em.lastname as Escalated_lastname, cm.lastname as Completed_lastname
 FROM Board b
 left join Member cr
   on cr.memberid = b.CreatorMemberID
 left join Member em
   on em.memberid = b.EscalatedMemberID
 left join Member cm
   on cm.memberid = b.CompletedMemberID

Open in new window

0
 

Author Comment

by:erin027
ID: 20363408
Thank you asvforce.
But can you give me an example query. I am beginner... Sorry.
0
 

Author Closing Comment

by:erin027
ID: 31411358
Always, Thank you angellll
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

656 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