Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 OUTER JOINS

Status
Not open for further replies.

carlosweiss

Programmer
Sep 15, 2005
15
AR
Hi,

Does anybody know the SQL Syntax for having outer joins to 2 tables within the same select statement?

This query returns an error:

Code:
select E.CTRL_DIRECT, MI.DESC as MI_DESC, 
FC.DESC as FC_DESC 
from table_E e 
[b]left outer join[/b] table_MI MI   
on E.MOT_INC_MENU = MI.CODE 
[b]left outer join [/b]table_FC FC 
on E.FREC_CTRL = FC.CODE    
where CUE = 'XXX'
 
You're probably not giving us enough information.

What database are you using?
What error message are you getting?

Does the CUE field appear in multiple tables? If so...
Where AliasName.Cue = 'XXX'

Replace AliasName with e, MI, or FC.



-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
I'm sorry, it is a syntax error.

The error message is (translated from Spanish)
Syntax error (missing operator) in the query expression
'E.MOT_INC_MENU = MI.CODE left outer join table_FC FC on E.FREC_CTRL = FC.CODE'


The CUE column is in table_E only, If I use e.CUE instead of CUE I get the same error.

The problem must be in how I'm adding the 2nd outer join. If I use one outer join only, the query runs fine.

Database is Access 2000.

Thanks,
 
Have you tried adding brackets around your first join

Code:
select E.CTRL_DIRECT, MI.DESC as MI_DESC, 
FC.DESC as FC_DESC 
from 
[b]
(
[/b]
table_E e 
left outer join table_MI MI on E.MOT_INC_MENU = MI.CODE
[b]
)
[/b] 
left outer join table_FC FC on E.FREC_CTRL = FC.CODE    
where CUE = 'XXX'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top