Select a.EmployeeName, sum(a.TotalDay) as [TotalAll] from Absence a left join SpecDate b on a.EmployeeName = b.EmployeeName where between StartDate and EndDate
ตรง where คิดไม่ออกค่ะ รบกวนช่วยคิดได้มั้ยคะ นึกทั้งวันไม่ได้ซักที
Select a.EmployeeName, sum(a.TotalDay) as [TotalAll]
from Absence a
left join SpecDate b
on a.EmployeeName = b.EmployeeName and (a.FormDate >= b.StartDate and a.EndDate <= b.EndDate)
Group by a.EmployeeName
select Absence.EmployeeName,sum(TotalDay)
from SpecDate,Absence
where (Absence.FromDate between SpecDate.StartDate and SpecDate.EndDate)
and (Absence.EndDate between SpecDate.StartDate and SpecDate.EndDate)
and Absence.EmployeeName = SpecDate.EmployeeName
group by Absence.EmployeeName
order by Absence.EmployeeName