Wheelsx5 Posted September 20, 2013 Share Posted September 20, 2013 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 More sharing options...
niche Posted September 20, 2013 Share Posted September 20, 2013 Look at your operators. Link to comment Share on other sites More sharing options...
Wheelsx5 Posted September 20, 2013 Author Share Posted September 20, 2013 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 More sharing options...
niche Posted September 21, 2013 Share Posted September 21, 2013 How does that work? Or, do you get the same error? Link to comment Share on other sites More sharing options...
Wheelsx5 Posted September 22, 2013 Author Share Posted September 22, 2013 That works - I create a table that consists of data from the three tables (Orders, Emplyees, Customers) . But I'm not sure what kind of joins I am creating. Union? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now