Hello I would like to SELECT the name of the customer who ordered this set of products like the Brazilian customers from Northwind database. I did brazilian products here:
select [ProductName]
from [dbo].[Products] join [dbo].[Order Details] on [dbo].[Products].ProductID = [dbo].[Order Details].ProductID
join [dbo].[Orders] on [dbo].[Order Details].OrderID = [dbo].[Orders].OrderID
join [dbo].[Customers] on [dbo].[Orders].CustomerID = [dbo].[Customers].CustomerID
where [Country] = 'Brazil'
but what now? How I can find them? I tried to do:
select [CompanyName], [ProductName]
from [dbo].[Customers] join [dbo].[Orders] on [dbo].[Orders].CustomerID = [dbo].[Customers].CustomerID
join [dbo].[Order Details] on [dbo].[Order Details].OrderID = [dbo].[Orders].OrderID
join [dbo].[Products] on [dbo].[Products].ProductID = [dbo].[Order Details].ProductID
where [ProductName] in (
select [ProductName]
from [dbo].[Products] join [dbo].[Order Details] on [dbo].[Products].ProductID = [dbo].[Order Details].ProductID
join [dbo].[Orders] on [dbo].[Order Details].OrderID = [dbo].[Orders].OrderID
join [dbo].[Customers] on [dbo].[Orders].CustomerID = [dbo].[Customers].CustomerID
where [Country] = 'Brazil')
but this also doesn't work :/