user214577
user214577

Reputation: 363

SQL left outer join syntax error

Im trying to run a query that uses a left outer join but i keep getting a syntax error. Im not sure whats causing it.

 SELECT employee.emp_num, employee.emp_lname, pilot.pil_license
 FROM employee LEFT OUTER JOIN pilot
 WHERE employee.emp_num = pilot.emp_num;

Upvotes: 1

Views: 3677

Answers (2)

user2299258
user2299258

Reputation:

Replace the "WHERE" by "ON". Only that.

Upvotes: 0

Andrew Lewis
Andrew Lewis

Reputation: 5256

I'm guessing your error is "Incorrect syntax near the keyword 'where'.". It should be rewritten thus:

SELECT employee.emp_num, employee.emp_lname, pilot.pil_license
FROM employee 
       LEFT OUTER JOIN pilot ON employee.emp_num = pilot.emp_num;

Upvotes: 5

Related Questions