获得本周截止到当前为止,所有用户的签到次数
select t.usermobile, themeId, to_char(trunc(sysdate, 'iw'), 'yyyy-mm-dd') begintime, to_char(trunc(sysdate, 'iw') + 6, 'yyyy-mm-dd') endtime, count(distinct t.attenddate) countOfAttendance from user_attendance t where attenddate >= to_char(trunc(sysdate, 'iw'), 'yyyy-mm-dd') and attenddate <= to_char(sysdate, 'yyyy-mm-dd') group by usermobile, themeid;
表结构
create table USER_ATTENDANCE
(
ID NUMBER(9) not null,
USERMOBILE VARCHAR2(15) not null,
THEMEID NUMBER(9),
ATTENDDATE VARCHAR2(19) not null
)