I am having a table with data like:
ID OrderId TAX% Quantity UnitCost
1 5 28 2 1280
2 5 18 1 1180
I want the output like:
ORDERID TaxableValue TaxValue
5 3000 740
How can I achieve this? I tried with:
SELECT orderid,
ROUND((SUM(UnitCost*Quantity)*TAX)/(100+TAX),2) AS taxValue,
ROUND(SUM(unitCost*quantity)-ROUND((SUM(UnitCost*Quantity)*TAX)/(100+TAX),2),2) AS taxableValue
FROM table1
GROUP BY OrderId;
But the query above is not working.
Sorry all, That is the Tax percentage. This is the new Updated Query. Please consider this.