ive search for this problems solution for a while and although ive found some similar answers i can not seem to put them toguether to get the result i want. My problem is as follows: I have 3 tables in sql server 2008 (dont know if that matters much)
Order (order_id, sales_id, Product_id,combo_id)
product(product_id, name,price)
combo(combo_id,name price)
it doesnt really matter what sales have. Now i wanna get a sum of all the price for a sale id but the thing is for each row one of bouth product_id or combo_id will be null and i cant seem to get a result from using an inner join between the 3 tables, i think im realy lost in this one so i would apreciate a lot any help i can get Ive also try the following with a partial good result
SELECT SUM(ISNULL(Combo.price, 0)) AS Expr1
FROM Order INNER JOIN
Combo ON Order.combo_id = Combo.combo_id
WHERE (Order.sales_id = @id)
i wanna do something similar joinning the 3 tables but ive had no such luck. Thx again