编写SQL查询:获取每分钟的平均值
我想查询每分钟的平均创建值。 除了使用下面的子查询,我没有任何想法。 是否有其他方法只使用一个查询(不使用子查询)编写SQL查询:获取每分钟的平均值,sql,postgresql,Sql,Postgresql,我想查询每分钟的平均创建值。 除了使用下面的子查询,我没有任何想法。 是否有其他方法只使用一个查询(不使用子查询) 创建的平均值可计算为: select count(*) / count(distinct date_trunc('minute', created)) from item where created > '2020-09-21 06:10'; 也就是说,将总数除以分钟数 select count(*) / count(distinct date_trunc('minute
创建的平均值可计算为:
select count(*) / count(distinct date_trunc('minute', created))
from item
where created > '2020-09-21 06:10';
也就是说,将总数除以分钟数
select count(*) / count(distinct date_trunc('minute', created))
from item
where created > '2020-09-21 06:10';