I have two tables as follows
PRODUCT table
PRODUCT
Id | Name | Price
And an ORDERITEM table
ORDERITEM
Id | Orde
i think this - including null value = 0
SELECT oi.id, SUM(nvl(oi.quantity,0) * nvl(p.price,0)) AS total_qty FROM ORDERITEM oi JOIN PRODUCT p ON p.id = oi.productid WHERE oi.orderid = @OrderId GROUP BY oi.id