Jump to content

Joining Multiple Tables


Wheelsx5

Recommended Posts

I am a newbie to SQL. I was going through the join tutorial on W3Schools and using the example database. I can’t seem to join three tables. I can join Orders and Employees and Orders and Customers, but not all three. What is the “operator” that I am missing? Thanks.

 

 

SELECT Orders.OrderID, EMPLOYEES.EMPLOYEEID,EMPLOYEES.LASTNAME,CUSTOMERS.CUSTOMERNAME,EMPLOYEES.LASTNAMEFROM ORDERSINNER JOIN EMPLOYEESON EMPLOYEES.EMPLOYEEID=ORDERS.EMPLOYEEIDINNER JOIN CUSTOMERSON CUSTOMERS.CUSTOMERID=ORDERS.CUSTOMERID;

 

Syntax error (missing operator) in query expression 'EMPLOYEES.EMPLOYEEID=ORDERS.EMPLOYEEID INNER JOIN CUSTOMERS ON CUSTOMERS.CUSTOMERID=ORDERS.CUSTOMERID'.

Link to comment
Share on other sites

I see that I can bypass the join statments altogether adn use Where. Is this what you mean?

 

SELECT Orders.OrderID, Employees.FirstName,Customers.CustomerNameFROM Orders,Employees,CustomersWhere orders.employeeid = employees.employeeid and Orders.CustomerID=Customers.CustomerIDORDER BY Orders.OrderID;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...