I have a table called Orders and another table called OrderDetails.
My Order table contains information about the order (who placed it, OrderDate, their BilltoID, etc)
The OrderDetails table contains line by line information about what products were part of the order. Example, productID, ProductName, productType, etc.
I have to begin with a query giving a list of the orders based on their BilltoID. That query is:
CASE ost.Name WHEN 'Taken' THEN 'In Progress'
ELSE ost.Name END AS OrderStatus
FROM vwOrders o INNER JOIN
vwOrderStatusTypes ost ON o.OrderStatusID=ost.ID
WHERE BillToID= 123456
How can I include in my query something that lets me know if there was a product of a certain productType in the order. I don't have to know the productID or any information about it, other than if the order contained a certain productType within the order. Something like a Boolean value called 'HasChart' which is set to 1 or 0. Any suggestions?