使用LEAST区间函数,计算累计纳税
计算累进税
2)算出总的纳税额度
计算累进税
1)算出每个计税区间中所应纳税额度
least
@MySQL---计算累进税
select user_name,sum(curmoney*rate) as taxmoney from( select user_name,money,low,high, least(money-low,high-low) as curmoney,rate from user1 a join taxrate b on a.money>b.low) a group by user_name