(case when b.max_coupon_id is not null then -(floor(abs(a.target_points)/a.coupon_num)+ pmod(a.target_points,a.coupon_num))
when b.max_coupon_id is null then -floor(abs(a.target_points)/a.coupon_num) else null end ) as coupon_points
select -(floor(abs(5)/2)+ pmod(5,2)) , -floor(abs(5)/2),abs(5)/2,pmod(5,2)
5 /2
3
2