use northwind
go

set statistics io on
go
SELECT orderid, customerid
FROM orders or1
WHERE 20 < (SELECT quantity
	 	FROM [order details] od
       	  WHERE or1.orderid = od.orderid
	  	AND od.productid = 23)
-- OR
SELECT orderid, customerid
FROM orders 
WHERE 20 < (SELECT quantity
	 	FROM [order details] 
       	  WHERE orders.orderid = [order details].orderid
	  	AND [order details].productid = 23)
--vs a join
SELECT or1.orderid, customerid, quantity
FROM orders or1
	INNER JOIN [order details] od ON or1.orderid = od.orderid AND od.productid = 23
WHERE quantity > 20
