同表子查询需要用到表别名,否则无法使用条件查询,sql语句“SELECT 姓名,(SELECT SUM(加班小计) FROM 考勤 as a WHERE (right(星期,1)='六' or right(星期,1)='日') and a.姓名=考勤.姓名) as 双休加班,(SELECT SUM(加班小计) FROM 考勤 as a WHERE right(星期,1)<>'六' and right(星期,1)<>'日' and a.姓名=考勤.姓名) as 工作日加班, SUM(加班小计) as 加班小计1,SUM(休假) as 休假1,SUM(早班时间) as 早班时间1,SUM(中班时间) as 中班时间1,SUM(夜班时间) as 夜班时间1 FROM 考勤 GROUP BY 姓名”可以达到你的需求,在mdb查询中运行通过,效果图如下:
能编个毛线衣吗?