hi
I have a master table columns like InvoiceID,InvoiceDate,Discount%,InvoiceTotal & detail table columns like ProductID,Qty,Price,Discount%,ExtendedPrice. Now I want to calculate both discount percentage as value in amount. I have the following query
SELECT InvoiceID, SUM(CONVERT(money, (Price * Qty) * (1 - Discount) / 100) * 100) AS ExtendedPrice FROM dbo.[InvoiceDetail] GROUP BY InvoiceIDwhich is just subtract detail discount only from ExtendedPrice but I want to Subtract both discount from the totalInvoiceAmount in order to get netSalesValue.