JRockFL
asked on
SQl Help - Get Only 1 product
How can I return only the orders that have 1 item with a productid of 46?
This query will return orders that contain multiple products including 46.
I want only orders that have 1 product and that has productid of 46
select *
from Orders a
inner join LineItems b
on a.OrderID = b.OrderID
and b.ProductID = 46
where a.OrderStatusID = 3
and a.GatewaySuccessful = 1
This query will return orders that contain multiple products including 46.
I want only orders that have 1 product and that has productid of 46
select *
from Orders a
inner join LineItems b
on a.OrderID = b.OrderID
and b.ProductID = 46
where a.OrderStatusID = 3
and a.GatewaySuccessful = 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER