Can anyone attempt to help me on why this query fails on the 2nd and 3rd joins?
SELECT schedheader.DATE,
schedheader.EXCEPTION_CODE,
schedheader.START_MINUTE,
schedheader.LENGTH,
scheddetail.EXCEPTION_CODE,
scheddetail.START_MINUTE,
scheddetail.LENGTH,
schedheader.CUSTOMER_ID,
[except].EXC_NAME
FROM schedheader LEFT OUTER JOIN scheddetail ON schedheader.EXCEPTION_CODE = scheddetail.EXCEPTION_CODE and
schedheader LEFT OUTER JOIN schedheader ON schedheader.EXCEPTION_CODE = [except].EXC_ID and
scheddetail LEFT OUTER JOIN scheddetail ON scheddetail.EXCEPTION_CODE = [except].EXC_ID
WHERE (((schedheader.CUSTOMER_ID)=2));
Query Analyzer shows
Server: Msg 156, Level 15, State 1, Line 11
Incorrect syntax near the keyword 'LEFT'.
Server: Msg 170, Level 15, State 1, Line 13
Line 13: Incorrect syntax near 'schedheader'.
However have been unsuccessfull in several variations to solve this.
Thanks!
SELECT schedheader.DATE,
schedheader.EXCEPTION_CODE,
schedheader.START_MINUTE,
schedheader.LENGTH,
scheddetail.EXCEPTION_CODE,
scheddetail.START_MINUTE,
scheddetail.LENGTH,
schedheader.CUSTOMER_ID,
[except].EXC_NAME
FROM schedheader LEFT OUTER JOIN scheddetail ON schedheader.EXCEPTION_CODE = scheddetail.EXCEPTION_CODE and
schedheader LEFT OUTER JOIN schedheader ON schedheader.EXCEPTION_CODE = [except].EXC_ID and
scheddetail LEFT OUTER JOIN scheddetail ON scheddetail.EXCEPTION_CODE = [except].EXC_ID
WHERE (((schedheader.CUSTOMER_ID)=2));
Query Analyzer shows
Server: Msg 156, Level 15, State 1, Line 11
Incorrect syntax near the keyword 'LEFT'.
Server: Msg 170, Level 15, State 1, Line 13
Line 13: Incorrect syntax near 'schedheader'.
However have been unsuccessfull in several variations to solve this.
Thanks!