相关文章推荐


mysql中关于分组的使用

MYSQL中按照季度、月份等分组_连接字符串



  1. select DATE_FORMAT(create_time,'%Y%u') weeks,count(caseid) count from tc_case group by weeks;


  2. select DATE_FORMAT(create_time,'%Y%m%d') days,count(caseid) count from tc_case group by days;


  3. select DATE_FORMAT(create_time,'%Y%m') months,count(caseid) count from tc_case group by months;



  4. 1、按照月份:


  5. select sum(total_amount) as total, date_format(stat_date, '%Y-%m') from week_report WHERE `stat_date` BETWEEN '2016-11-02' AND '2017-04-30' group by date_format(stat_date, '%Y-%m');


  6. select sum(total_amount) as total,date_format(stat_date, '%Y-%m') from week_report WHERE `stat_date` BETWEEN '2016-12-11' AND '2016-12-22' group by date_format(stat_date, '%Y-%m');


  7. 获得按照月份分组进行汇总的数据。



  8. concat()连接字符串



  9. -- month


  10. select CONCAT(YEAR(stat_date),'_',DATE_FORMAT(stat_date,'%m')) months ,sum(total_amount) as count_amount, sum(total_new_user) as count_new_user, sum(da_active_user) as count_active_user from xxx


  11. WHERE `stat_date` BETWEEN '2016-01-02' AND '2017-05-30' group by months;



  12. -- 季度


  13. select CONCAT(YEAR(stat_date),'_',quarter(stat_date)) qu,sum(total_amount) as count_amount, sum(total_new_user) as count_new_user, sum(da_active_user) as count_active_user from xxx


  14. WHERE `stat_date` BETWEEN '2016-01-02' AND '2017-05-30' group by qu;



  15. -- 周


  16. select CONCAT(YEAR(stat_date),'_',DATE_FORMAT(stat_date,'%U')) weeks,sum(total_amount) as count_amount, sum(total_new_user) as count_new_user, sum(da_active_user) as count_active_user from xxx


  17. WHERE `stat_date` BETWEEN '2016-01-02' AND '2017-05-30' group by weeks;



  18. -- 天


  19. select CONCAT(YEAR(stat_date),'_',DATE_FORMAT(stat_date,'%m'),'_',DATE_FORMAT(stat_date,'%d')) days, sum(total_amount) as count_amount, sum(total_new_user) as count_new_user, sum(da_active_user) as count_active_user from xxx


  20. WHERE `stat_date` BETWEEN '2016-01-02' AND '2017-05-30' group by days
  21. 聊天界面代码java java实现聊天功能窗口

    大家都知道java中的图形界面设计,下面我就来给大家演示一下聊天窗口的设计,首先我们的目标是设计成这样:通过分析我们不难发现图形中有下拉框,文本框,按钮,文本域等,下面请看代码:package com.i; import java.awt.*; import javax.swing.*; public class Calculator extends JFrame{ //继承JFra

 
推荐文章