zoukankan      html  css  js  c++  java
  • 统计一周内工作日志数量并且算出那个时间段谁没写

    select a.click_date,IFNULL(b.count,0),b.yhbh
    from (
    SELECT curdate() as click_date
    union all
    SELECT date_sub(curdate(), interval 1 day) as click_date
    union all
    SELECT date_sub(curdate(), interval 2 day) as click_date
    union all
    SELECT date_sub(curdate(), interval 3 day) as click_date
    union all
    SELECT date_sub(curdate(), interval 4 day) as click_date
    union all
    SELECT date_sub(curdate(), interval 5 day) as click_date
    union all
    SELECT date_sub(curdate(), interval 6 day) as click_date
    ) a left join (
    select date(start_date) as datetime, count(*) as count,GROUP_CONCAT(yhbh) as yhbh
    from work_log
    group by date(start_date)
    ) b on a.click_date = b.datetime;

    select count(DISTINCT yhbh),date(start_date) as date,GROUP_CONCAT(DISTINCT yhbh) from work_log where datediff(now(),start_date)<=7
    group by day(start_date);

  • 相关阅读:
    FreePbx
    ntpdate和date
    Linux系统/dev/mapper目录浅谈
    利用rsync做全平台备份
    windows 共享给 linux
    Linux、UNIX设置开机自动运行命令
    JNU周练1019
    JNU周练1013
    2013/7/30 JNU周练
    二叉树遍历
  • 原文地址:https://www.cnblogs.com/java-llp/p/11395832.html
Copyright © 2011-2022 走看看