一句sql搞定个人所得税计算


declare @salary numeric(18,2)
select @salary = 1000000 - 1600
select  sum(case when tax1 < 0 then 0 else tax1 end)  没减去速算扣除数_税款,
        sum(case when tax2 < 0 then 0 else tax2 end)  减去速算扣除数_税款
from
(
select  (case when @salary > left_point  then  case when @salary > right_point then right_point - left_point else @salary - left_point end else 0 end )  *  tax_percent  / 100 - agio_value  as tax1,
        (case when @salary > left_point  then  case when @salary > right_point then right_point - left_point else @salary - left_point end else 0 end )  *  tax_percent  / 100  as tax2 ,
        (case when @salary > left_point  then  case when @salary > right_point then right_point - left_point else @salary - left_point end else 0 end ) xxx,
         @salary salary, left_point, right_point, tax_percent/100 tax_percent, agio_value
from
 (
 select 0.00 left_point, 500.00 right_point,5.00 tax_percent,0.00 agio_value
 union all
 select 500.00,  2000.00,     10.00,      25.00 
 union all
 select 2000.00,         5000.00,     15.00,      125.00 
 union all
 select 5000.00,         20000.00,     20.00,      375.00 
 union all
 select 20000.00, 40000.00,     25.00,      1375.00 
 union all
 select 40000.00, 60000.00,     30.00,           3375.00 
 union all
 select 60000.00, 80000.00,     35.00,      6375.00 
 union all
 select 80000.00, 100000.00,     40.00,      10375.00 
 union all
 select 100000.00, 999999999999.00,    45.00,      15375.00 
 ) xxx
) yyy


 


转载于:https://www.cnblogs.com/bigmouthz/archive/2007/12/07/986347.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值