Skip to content

Commit 30b7c78

Browse files
committed
累计税计算
1 parent 40e3413 commit 30b7c78

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
计算累进税类问题
2+
使用least()实现计算不同区间个人所得税:
3+
select user_name,sum(curmoney*rate)as taxmoney
4+
from(
5+
select user_name,money,low,high,
6+
least(money-low,high-low) as curmoney,rate
7+
from user1 a join taxrate b
8+
on a.money>b.low
9+
) a
10+
group by user_name

0 commit comments

Comments
 (0)