Why doesn't this work? select (select CustomerID from orders o inner join [Order Details] od on rderId = od.OrderId inner join Products p on od.ProductId = p.Productid where p.ProductName = 'Chocolade') as "Column1", (select CustomerID from orders o inner join [Order Details] od on rderId = od.OrderId inner join Products p on od.ProductId = p.Productid where p.ProductName = 'Vegie-spread') as "Column2"
to correct your syntax select Column1.CustomerID, Column2.CustomerID from ( select CustomerID from orders o inner join [Order Details] od on rderId = od.OrderId inner join Products p on od.ProductId = p.Productid where p.ProductName = 'Chocolade' ) Column1, ( select CustomerID from orders o inner join [Order Details] od on rderId = od.OrderId inner join Products p on od.ProductId = p.Productid where p.ProductName = 'Vegie-spread' ) Column2 but you can write it in a more simple way select CustomerID, p.ProductName from orders o inner join [Order Details] od on rderId = od.OrderId inner join Products p on od.ProductId = p.Productid where p.ProductName IN ('Vegie-spread', 'Chocolade') Bambola.