嘿,伙计们,一个快速的 mysql 问题,我得到了这个当前的查询,这让我头疼
SELECT stafflist.id, stafflist.full_name, (wages.wage /5) * stafflist.avgworkingdays AS workingwage ,
count(sick.d) AS DaysOffSick, variables.value AS VAT, count(hols.d) AS Prebooked_Holidays,
((((wages.wage /5) * stafflist.avgworkingdays)/stafflist.avgworkingdaysmonth)*count(sick.d)) AS daysoffsickvalue,
((((((wages.wage / 5) * stafflist.avgworkingdays) * 3 ) /100) * (100 + variables.value))/ (stafflist.avgworkingdaysmonth)) * (stafflist.avgworkingdaysmonth
- count(hols.d)) AS Commision_target_After_Holidays
from stafflist
LEFT JOIN wages ON wages.wagesid = stafflist.WageGrade
LEFT JOIN variables ON variables.company=stafflist.company and variables.name = 'VAT'
LEFT JOIN off AS sick ON sick.StaffMember = stafflist.id and sick.isitsick=1 AND sick.addedtowages=0
LEFT JOIN off As hols ON hols.StaffMember = stafflist.id and hols.isitsick=0 AND hols.addedtowages=0 AND hols.m = MONTH(now()) -1 AND hols.prebooked=1
WHERE stafflist.id = 48
GROUP By stafflist.full_name
问题是我希望它计算有多少天被标记为病假,有多少天被标记为假期但是一旦我离开后再次加入表外并将其命名为 hols 字段 daysoffsick 拉出标记为假期的日期
你能帮我解决这个问题吗
问候谢恩