To get a average % of two columns
I have the columns as mentioned below
1)OldOrderQty 2)NewOrderQty 3)OLdunitRate 4)NewUnitRate
My issue is i need to get % of savings if there is any savings for the new unit rate
Please help me out with this thanks a lo开发者_StackOverflowt for any answers
Your question and terms aren't well defined, but this is what I'd lean towards:
SELECT 100*(1-NewUnitRate/OLdunitRate) AS percent_savings
FROM table
So, for example, if your OLdunitRate
was 10, and your NewUnitRate
was 7.5, your percent savings would be 25%.
3 * 1 = x
4 * 2 = y
y / x = would be the savings I presume
精彩评论