sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=1,netpay,0)) as last1,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=2,netpay,0)) as last2,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=3,netpay,0)) as last3,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=4,netpay,0)) as last4,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=5,netpay,0)) as last5,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=6,netpay,0)) as last6,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=7,netpay,0)) as last7,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=8,netpay,0)) as last8,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=9,netpay,0)) as last9,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=10,netpay,0)) as last10,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=11,netpay,0)) as last11,
sum(if((month(curdate())+year(curdate())*12)-(mth+year*12)=12,netpay,0)) as last12,
0 as recordid, ' ' as status
from payroll group by employeenumber,surname;
沒有留言:
張貼留言