转自:https://blog.csdn.net/weixin_45616246/article/details/117598051
代码如下
日: DAY; 周: WEEK; 月: MONTH; 季度: QUARTER; 年: YEAR
1 select 2 date_trunc('DAY', create_time) as statisticTime, 3 user_name, count(0) 4 from user 5 GROUP BY date_trunc('DAY', create_time), user_name