ตอบข้อ 1. จำนวนที่ผมใช้ ขึ้นอยุ่กับการกรองวันที่และแผนกครับ ถ้าน้อยสุดน่าจะ 1 วัน แต่จำนวนอาจจะ 1 ถึง 7 row ตามจำนวนพนักงานในแผนกนั้น
ตอบข้อ 2. SQL view ตามนี้ครับ
INSERT INTO tbEmployeeOT ( Emp_docNum, Emp_ID, Emp_TitleName, Emp_Name, Emp_Surname, Emp_Branch, Emp_Dep, Emp_Div, Emp_Position, Emp_RangLevel, Emp_Level, Emp_Date, Emp_TypeWork, Emp_Timein, Emp_Timeout, Emp_DedugPay )
SELECT dbo_ViewTimeOTMonthly.Period, dbo_ViewTimeOTMonthly.Employee3, dbo_ViewTimeOTMonthly.TitleEng, dbo_ViewTimeOTMonthly.Name1, dbo_ViewTimeOTMonthly.Lastname1, dbo_ViewTimeOTMonthly.Branch, dbo_ViewTimeOTMonthly.department, dbo_ViewTimeOTMonthly.divition, dbo_ViewTimeOTMonthly.Positionn, dbo_ViewTimeOTMonthly.RangLevel, dbo_ViewTimeOTMonthly.Level, dbo_ViewTimeOTMonthly.Date, dbo_ViewTimeOTMonthly.TypeDay, dbo_ViewTimeOTMonthly.InTime, dbo_ViewTimeOTMonthly.OutTime, dbo_ViewTimeOTMonthly.disOT
FROM dbo_ViewTimeOTMonthly
GROUP BY dbo_ViewTimeOTMonthly.Period, dbo_ViewTimeOTMonthly.Employee3, dbo_ViewTimeOTMonthly.TitleEng, dbo_ViewTimeOTMonthly.Name1, dbo_ViewTimeOTMonthly.Lastname1, dbo_ViewTimeOTMonthly.Branch, dbo_ViewTimeOTMonthly.department, dbo_ViewTimeOTMonthly.divition, dbo_ViewTimeOTMonthly.Positionn, dbo_ViewTimeOTMonthly.RangLevel, dbo_ViewTimeOTMonthly.Level, dbo_ViewTimeOTMonthly.Date, dbo_ViewTimeOTMonthly.TypeDay, dbo_ViewTimeOTMonthly.InTime, dbo_ViewTimeOTMonthly.OutTime, dbo_ViewTimeOTMonthly.disOT, Year([date]), Month([date]), Day([date])
HAVING (((Year([date]))>=[Forms]![FormSelect]![cbbYearS] And (Year([date]))<=[Forms]![FormSelect]![cbbYearE]) AND ((Month([date]))>=[Forms]![FormSelect]![cbbmonthS] And (Month([date]))<=[Forms]![FormSelect]![cbbMonthE]) AND ((Day([date]))>=[Forms]![FormSelect]![cbbDateS] And (Day([date]))<=[Forms]![FormSelect]![cbbDateE]));