Multiple SQL Joins error in W3Schools Tryit Editor

0 votes

I'm hoping you can assist me with this little challenging issue. Using the W3Schools SQL course, I'm creating "real-world" queries as I go along to attempt and gain some experience with this. I'm attempting to determine who ordered what using their information by utilising the following:

SELECT c.CustomerName, p.ProductName
FROM Customers c inner join Orders o on c.CustomerID = o.CustomerID
    JOIN OrderDetails od on od.OrderID = o.OrderID
    JOIN Products p on p.ProductID = od.ProductID;

This keeps returning the error:

Syntax error (missing operator) in query expression 'c.customerid = o.customerid join orderdetails od on od.orderid = o.orderid join products p on p.productid = od.productid'.

After much tinkering and having a more knowledgeable colleague review my query, we are unable to identify anything incorrect with what I have typed.

Please give me some assistance or direction.

Sep 17, 2022 in Database by Kithuzzz
• 38,000 points
2,139 views
Try writing INNER JOIN instead of JOIN

SELECT c.CustomerName, p.ProductName FROM Customers c INNER JOIN Orders o ON c.CustomerID = o.CustomerID INNER JOIN OrderDetails od ON od.OrderID = o.OrderID INNER JOIN Products p ON p.ProductID = od.ProductID;

1 answer to this question.

0 votes

I'm ruining this query on w3school even though it isn't incorrect or returning any errors.

Open this link and paste the query.

    SELECT c.CustomerName, p.ProductName
    FROM Customers c inner join Orders o on c.CustomerID = o.CustomerID
    JOIN OrderDetails od on od.OrderID = o.OrderID
    JOIN Products p on p.ProductID = od.ProductID;
answered Sep 18, 2022 by narikkadan
• 63,600 points

Related Questions In Database

0 votes
1 answer

Inserting multiple rows in a single SQL query?

In SQL Server 2008, multiple rows can ...READ MORE

answered Feb 10, 2022 in Database by Vaani
• 7,070 points
1,141 views
0 votes
0 answers

How to find sum of multiple columns in a table in SQL Server 2005?

I have a table Emp which has these rows: Emp_cd ...READ MORE

Aug 19, 2022 in Database by Kithuzzz
• 38,000 points
1,744 views
0 votes
0 answers

Shortcut for changing the editor font size in Oracle SQL Developer

Is there a shortcut in Oracle SQL ...READ MORE

Aug 27, 2022 in Database by Kithuzzz
• 38,000 points
2,206 views
0 votes
0 answers

How to DROP multiple columns with a single ALTER TABLE statement in SQL Server?

In one ALTER TABLE statement, I would ...READ MORE

Sep 2, 2022 in Database by Kithuzzz
• 38,000 points
950 views
0 votes
1 answer

Want a command to be executed in Salt only if a directory is empty

You should consider using this inside your ...READ MORE

answered Jun 12, 2018 in DevOps Tools by Damon Salvatore
• 5,980 points
1,964 views
0 votes
1 answer

Creating A New MySQL User In Amazon RDS Environment

AWS RDS security groups documentation (a common ...READ MORE

answered Jul 18, 2018 in AWS by Priyaj
• 58,020 points
2,173 views
0 votes
1 answer

Using conditional to execute a command in salt

You can use unless inside your state ...READ MORE

answered Jul 23, 2018 in Other DevOps Questions by DareDev
• 6,890 points
2,188 views
0 votes
0 answers

How to ALTER multiple columns at once in SQL Server

ALTER the data types of several columns in ...READ MORE

Aug 12, 2022 in Database by Kithuzzz
• 38,000 points
2,827 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