Joining 2 tables with more then one join

kisnay82

New Member
Joined
May 17, 2017
Messages
14
Hi
I have 2 tables, in both tables there is week number and employee id, i need to join them both up, but keep getting the error

[h=1]The SQL statement could not be executed because it contains ambiguous outer joins. To force one of the joins to be performed first, create a separate query that performs the first join and then include that query in your SQL statement.[/h]
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Do you have other tables and other joins in this query? If so, post the SQL for the query before you are trying to add this step.

If not, I am guessing that you have not selected the same type of Join for each field. They BOTH have to be the same (whether it is Inner, Left, Right, etc).
 
Upvote 0
The sql i currently have is

SELECT qry1.[Week Num], qry1.Text, qry1.EmployeeName, qry1.ResID, tblAnnualLeave.Hours, tblAnnualLeave.Week, tblAnnualLeave.ResIDFROM tblAnnualLeave RIGHT JOIN qry1 ON tblAnnualLeave.Week = qry1.[Week Num];

i want to add qry1.ResID = tblAnnualLeave.ResID
 
Upvote 0
i want to add qry1.ResID = tblAnnualLeave.ResID

what was the actual sql you created when you added this. It doesn't look quite like you should have any problems just adding a second condition here.
 
Upvote 0
Assuming that your first query works, make this change:
Code:
[COLOR=#333333]SELECT qry1.[Week Num], qry1.Text, qry1.EmployeeName, qry1.ResID, tblAnnualLeave.Hours, tblAnnualLeave.Week, tblAnnualLeave.ResID 
FROM tblAnnualLeave 
RIGHT JOIN qry1 
ON (tblAnnualLeave.Week = qry1.[Week Num]) [/COLOR][COLOR=#ff0000]AND (tblAnnualLeave.ResID = qry1.ResID)[/COLOR][COLOR=#333333];[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,570
Messages
6,173,126
Members
452,502
Latest member
perrygreen98

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top