标签:col style class cal 数据 where span rds strong
查询今天数据:
SELECT COUNT(1) FROM T_CALL_RECORDS WHERE TO_CHAR(T_RKSJ,‘YYYY-MM-DD‘)=TO_CHAR(SYSDATE,‘YYYY-MM-DD‘)
查询昨天数据:
SELECT COUNT(1) FROM T_CALL_RECORDS WHERE TO_CHAR(T_RKSJ,‘YYYY-MM-DD‘)=TO_CHAR(SYSDATE-1,‘YYYY-MM-DD‘)
查询本周数据:
SELECT COUNT(1) FROM T_CALL_RECORDS WHERE T_RKSJ >= TRUNC(NEXT_DAY(SYSDATE-8,1)+1) AND T_RKSJ < TRUNC(NEXT_DAY(SYSDATE-8,1)+7)+1
查询上周数据:
SELECT COUNT(1) FROM T_CALL_RECORDS WHERE T_RKSJ >= TRUNC(NEXT_DAY(SYSDATE-8,1)-6) AND T_RKSJ < TRUNC(NEXT_DAY(SYSDATE-8,1)+1)
查询本月数据:
SELECT COUNT(1) FROM T_CALL_RECORDS WHERE TO_CHAR(T_RKSJ,‘YYYY-MM‘)=TO_CHAR(SYSDATE,‘YYYY-MM‘)
查询上月数据:
SELECT COUNT(1) FROM T_CALL_RECORDS WHERE TO_CHAR(T_RKSJ,‘YYYY-MM‘)=TO_CHAR(ADD_MONTHS(SYSDATE,-1),‘YYYY-MM‘)
备注:NEXT_DAY(SYSDATE,1)函数为当前系统时间的下个星期日时间,数字1代表星期日
标签:col style class cal 数据 where span rds strong
原文地址:https://www.cnblogs.com/henuyuxiang/p/11609304.html