PostgreSQL分组(GROUP BY子句)

select u.created_ts, count(*) from tb_user u group by u.created_ts
注意:不能缺少聚合函数
PostgreSQL分组(GROUP BY子句)
按月分组统计
select
to_char(to_timestamp(created_ts/1000), ‘YYYY-MM’) as month,
count(id) as total_call
from tb_user
where
created_ts between 1548568440000 and 1552456440000
group by month
order by month
PostgreSQL分组(GROUP BY子句)

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2021-04-07
  • 2021-10-22
  • 2022-12-23
  • 2021-10-04
  • 2021-11-16
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-10-19
  • 2021-09-14
  • 2022-01-19
  • 2022-03-09
相关资源
相似解决方案