开发者

To get a average % of two columns

开发者 https://www.devze.com 2023-01-31 09:17 出处:网络
I have the columns as mentioned below 1)OldOrderQty 2)NewOrderQty 3)OLdunitRate 4)NewUnitRate My issue is i need to get % of savings

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号