select count(上班考勤标记 ) from table group by 上班考勤标记 having ( 时间1<当前时间<时间2)
select count(上班考勤标记) as 正常 where (日期 between xxxx and xxxx)and(上班考勤标记='正常') union select count(上班考勤标记) as 迟到 where (日期 between xxxx and xxxx)and(上班考勤标记='迟到')
/* 请参考 */ select 日期, (select count(*) from 考勤表 where 上班考勤标记 = '正常' and 日期 = A.日期) as 正常次数, (select count(*) from 考勤表 where 上班考勤标记 = '迟到' and 日期 = A.日期) as 迟到次数, (select count(*) from 考勤表 where 下班考勤标记 = '早退' and 日期 = A.日期) as 早退次数 from 考勤表 as A --where 你的条件 group by 日期
我试了不行啊? SELECT 姓名, COUNT(上班考勤标记) AS Expr1, COUNT(上班考勤标记) AS Expr2 FROM 考勤表 GROUP BY 姓名, 上班考勤标记,下班考勤标记
SELECT 姓名, 上班考勤标记, 下班考勤标记, Count(*) AS 次数 FROM 考勤表 GROUP BY 姓名, 上班考勤标记, 下班考勤标记
(日期 between xxxx and xxxx)and(上班考勤标记='正常')
union
select count(上班考勤标记) as 迟到 where
(日期 between xxxx and xxxx)and(上班考勤标记='迟到')
select 日期,
(select count(*) from 考勤表 where 上班考勤标记 = '正常' and 日期 = A.日期) as 正常次数,
(select count(*) from 考勤表 where 上班考勤标记 = '迟到' and 日期 = A.日期) as 迟到次数,
(select count(*) from 考勤表 where 下班考勤标记 = '早退' and 日期 = A.日期) as 早退次数
from 考勤表 as A
--where 你的条件
group by 日期
SELECT 姓名, COUNT(上班考勤标记) AS Expr1, COUNT(上班考勤标记) AS Expr2
FROM 考勤表
GROUP BY 姓名, 上班考勤标记,下班考勤标记
FROM 考勤表
GROUP BY 姓名, 上班考勤标记, 下班考勤标记