UPDATE Tab_Checksum
SET 姓名=[name],
考勤日期=checkdate,
按時上課=(SUM(startclass)
FROM Tab_Check
GROUP BY [name],checkdate),
按時下課=(SUM(finishclass)
FROM Tab_Check
GROUP BY [name],checkdate),
遲到=(SUM(later)
FROM Tab_Check
GROUP BY [name],checkdate),
曠課=(SUM(absenteeism)
FROM Tab_Check
GROUP BY [name],checkdate),
早退=(SUM(startclass)-SUM(finishclass)
FROM Tab_Check
GROUP BY [name],checkdate),)
ORDER BY[name],checkdate
這是我寫的,為什麼呢,謝謝啦
所有這些 SUM(前面都要加 select
按時上課=(SELECT SUM(startclass) FROM Tab_Check GROUP BY [name],checkdate),