SQL Server replaces LEFT JOIN for LEFT OUTER JOIN in view query

0 votes
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?
Feb 4 in Database by Vaani
• 7,020 points
292 views

1 answer to this question.

0 votes
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.

Type 1: INNER JOIN - only where both tables match
1.) INNER JOIN aka JOIN

Type 2: OUTER JOINS where either one or both tables match
1.) LEFT OUTER JOIN aka LEFT JOIN

2.) RIGHT OUTER JOIN aka RIGHT JOIN

3.) FULL OUTER JOIN aka FULL JOIN

Type 3: CROSS JOIN - Cartesian product(all possible combos of each table)
answered Feb 4 by Neha
• 8,940 points

Related Questions In Database

0 votes
0 answers

How do I query for all dates greater than a certain date in SQL Server?

I tried this: SELECT * FROM dbo.March2010 A WHERE ...READ MORE

Aug 29 in Database by Kithuzzz
• 20,660 points
72 views
0 votes
0 answers

How Stuff and 'For Xml Path' work in SQL Server?

Table is: Id Firstname 4 abc 4 def 4 ghi 4 jkl 4 mno Required output: Id Name 4 abc,def,ghi,jkl,mno Query: SELECT ID, ...READ MORE

Feb 23 in Database by Neha
• 8,940 points
1,381 views
0 votes
0 answers

How can I show the table structure in SQL Server query?

Query: SELECT DateTime, Skill, Name, TimeZone, ID, User, ...READ MORE

Aug 11 in Database by Kithuzzz
• 20,660 points
110 views
0 votes
0 answers

Update Query with INNER JOIN between tables in 2 different databases on 1 server

Both databases are on the same server. db1 ...READ MORE

Aug 12 in Database by Kithuzzz
• 20,660 points
70 views
0 votes
1 answer

SQL Server replaces LEFT JOIN for LEFT OUTER JOIN in view query

there are different ways of writing joins. ...READ MORE

answered Jun 9 in Others by nisha
• 2,190 points
93 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3 in Database by Vaani
• 7,020 points
167 views
0 votes
0 answers

How do I UPDATE from a SELECT in SQL Server?

INSERT INTO Table (col1, col2, col3) SELECT col1, ...READ MORE

Feb 4 in Database by Vaani
• 7,020 points
71 views
0 votes
1 answer

What is a stored procedure?

A stored procedure is a set of ...READ MORE

answered Feb 4 in Database by Neha
• 8,940 points
299 views
0 votes
1 answer

LEFT JOIN vs. LEFT OUTER JOIN in SQL Server

At the top level there are mainly ...READ MORE

answered Feb 4 in Database by Neha
• 8,940 points
283 views
0 votes
1 answer

Syntax of for-loop in SQL Server

TSQL has no for-loop, we have only ...READ MORE

answered Feb 15 in Database by Neha
• 8,940 points
232 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP