首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

取得本周截止到当前为止,所有用户的签到次数

2012-07-25 
获得本周截止到当前为止,所有用户的签到次数select t.usermobile,themeId,to_char(trunc(sysdate, iw),

获得本周截止到当前为止,所有用户的签到次数

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
)

热点排行