- UID
- 223356
- 帖子
- 574
- 主题
- 96
- 注册时间
- 2011-7-11
- 最后登录
- 2016-4-19
|
5#
发表于 2011-10-4 03:24
| 只看该作者
You can also use MIN for this one:
EOS = YoS*Sal - MIN(5,YoS)*(Sal/2)
Gives you a salary for each year of service, but removes 1/2 of it for each of the first five years.
No IF, AND, or BUTs.
You will need IF if the rules mean that a 6 year worker gets 6 years at full salary and not 5 years of half salaries and 1 year at full (though you might be able to substitute a boolean (YoS<=5) for the MIN term and have it work like that)
Edited 1 time(s). Last edit at Saturday, April 30, 2011 at 09:44AM by bchadwick. |
|