SQL - SELECT statement with a JOIN
I'm using the Northwind database, and I can't manage to get the following
query to work -
select *
from customers
join orders
on orders.customerID = customers.customerID
join [Order Details]
on orders.OrderID = [Order Details].orderID
join Products (select Products.productID, Products.ProductName from
Products)
on [Order Details].productID = Products.productID
order by customers.customerID
I get an error saying that there's incorrect syntax near the select in
line 7.
What I'm trying to do is that when joining the Products table, it won't
bring all the columns but rather just the ProductName and ProductID.
Could somebody please explain what I'm doing wrong? Thanks!
No comments:
Post a Comment