zoukankan      html  css  js  c++  java
  • 日常sql

    -- 京东卡领取数,按人统计
    select substr(create_time,1,7),count(distinct user_id) from t_esb_award_record where award_type_id = 2 and create_time > '2019-01-01 00:00:00' group by substr(create_time,1,7);

    -- 达标保单统计
    select substr(create_time,1,7),count(1) from t_plus_achive_target_record where create_time > '2019-01-01 00:00:00' group by substr(create_time,1,7);

    -- 京东卡领取数
    select substr(create_time,1,7),count(1) from t_esb_award_record where award_type_id = 2 and create_time > '2019-01-01 00:00:00' group by substr(create_time,1,7);

    -- 折扣券领取数
    select substr(create_time,1,7),count(1) from t_esb_award_record where award_type_id = 1 and create_time > '2019-01-01 00:00:00' group by substr(create_time,1,7);

     select count(distinct(policy_no))from t_order where create_time<'2020-04-01 00:00:00' and end_date> '1582992000000' and insurance_code in('P156') and del_flag = 0;

    select count(1),update_time from t_plus_achive_target_record where syn_flag = 2 and update_time like concat(substr(now(),1,10),'%') group by update_time;/*每天推送数据*/
    select count(1),update_time from t_plus_achive_target_record where syn_flag = 2 and update_time like concat(substr(date_sub(now(),interval 1 day) ,1,10),'%') group by update_time;/*上一天推送数据*/


    /*各个产品按小时统计*/
    select insurance_code,insurance_name,substr(create_time,1,13),count(1) from t_order where id > 1000000 and order_status> 5 and order_type = 1 and create_time > '2019-11-25 00-00-00' group by insurance_code,insurance_name,substr(create_time,1,13);
    /*各个产品统计*/
    select insurance_code,insurance_name,count(1) from t_order where id > 1000000 and order_status> 5 and order_type = 1 and create_time > '2019-11-25 00-00-00' and create_time < '2019-11-25 09-00-00' group by insurance_code,insurance_name;

  • 相关阅读:
    【Mysql学习笔记】浅析mysql的binlog
    HBase 学习笔记---守护进程及内存调优
    字符集例子-同一字符不同字符集编码不同及导入导出的乱码
    随机访问
    格式化的代价
    读写文本文件
    缓冲
    加速I/O的基本规则
    序列化再探讨
    数据库I/O:CMP、Hibernate
  • 原文地址:https://www.cnblogs.com/xingminghui/p/12607480.html
Copyright © 2011-2022 走看看