Solved

Three (3) table join (sql)

Posted on 2002-05-27
5
167 Views
Last Modified: 2010-05-02
Hello All,

I need to join all records from the following tables.

Table1 (Main Table): tbl_DR_Records (Primary Key: DReferID)

Join the records from these tables:

Table2: tbl_DR_ExplainAction (Field: DReferID)
Table3: tbl_DR_MultiSpots (Field: MEReferID)

Thanks as always...

-ADawn
0
Comment
Question by:ADawn
5 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 50 total points
ID: 7037042
select *
from tbl_DR_Records as T1
left join tbl_DR_ExplainAction as T2
on t1.DReferID = T2.DReferID
left join tbl_DR_MultiSpots AS T3
on t1.DReferID = T3.MEReferID
0
 
LVL 5

Expert Comment

by:kcm76
ID: 7037652

Select D.*
from tbl_DR_Records D, DR_ExplainAction E, Multispots M
where D.DReferID = E.DReferID and D.DReferID = M.MEReferID

ALL THE BEST

KCM
0
 
LVL 1

Expert Comment

by:killer5
ID: 7038466
a safer way to do it... :D
The problem with the other SQLs is that it will not return any records if there are no records in DR_ExplainAction and/or DR_MultiSpots

SELECT tbl_DR_Records .*
FROM tbl_DR_Records T1
LEFT OUTER JOIN
 tbl_DR_ExplainAction T2 ON T1.DReferID = T2.DReferID
LEFT OUTER JOIN
 tbl_DR_MultiSpots T3 ON T3.MEReferID = T1.DReferID
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7038744
killer5, what is the diffence between your comment and mine?
0
 

Author Comment

by:ADawn
ID: 7099632
Thanks for your help.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

810 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