Solved

Three (3) table join (sql)

Posted on 2002-05-27
5
165 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 69

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 69

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

744 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

10 Experts available now in Live!

Get 1:1 Help Now