$strSQL = "SELECT USERID,count(USERID) FROM checkinout WHERE CHECKTIME BETWEEN '2012-01-01' and '2012-01-31'and date_format(CHECKTIME,'%H:%i')>='08:00' and CHECKTYPE= 'I' GROUP BY USERID, ";
$strSQL = "SELECT distinct(CHECKTIME),USERID,count(USERID) FROM checkinout WHERE CHECKTIME BETWEEN '2012-01-01' and '2012-01-31'and date_format(CHECKTIME,'%H:%i')>='08:00' and CHECKTYPE= 'I' GROUP BY USERID, ";
ลองดูน่ะครับ ผมไม่แน่ใจเหมือนกัน ไม่มี db ให้ลอง อิอิ
select distinct(CHECKTIME) ออกมาด้วย แต่ไม่เอาใช้ก็ได้ครับ
$strSQL = "SELECT USERID,count(distinct date(checktime)) FROM checkinout WHERE CHECKTIME BETWEEN '2012-01-01' and '2012-01-31'and date_format(CHECKTIME,'%H:%i')>='08:00' and CHECKTYPE = 'I' GROUP BY USERID ";