Reputation: 33956
I need to use a LEFT JOIN in a View however SQL Server replaces LEFT JOIN for LEFT OUTER JOIN every time I save my view.
When trying to use LEFT INNER JOIN explicitly I get the error "Incorrect syntax near word 'INNER'". What is more when I want to create an index for the view I get the error "Cannot add clustered index to views using OUTER JOINS".
It's maddening, and ideas why this could be happening?
So when I try to create an index for the view I get the message I used an outer join though I didn't.
Upvotes: 2
Views: 29888
Reputation: 6018
You are getting the joins confused and keep in mind there are different ways of writing joins. What you're looking for is a LEFT OUTER JOIN(OUTER is an optional). There is no LEFT INNER JOIN.
There are three major types of joins.
1.) INNER JOIN aka JOIN
1.) LEFT OUTER JOIN aka LEFT JOIN
2.) RIGHT OUTER JOIN aka RIGHT JOIN
3.) FULL OUTER JOIN aka FULL JOIN
1.) Cross Join
Here's a graphic showing how each works:
Upvotes: 16