0
我想要为每个app
我想存储一个数组series
,其中每个元素是在给定日期创建的数量conversations
。将数组嵌套到列
任何想法如何实现?这是我到目前为止得到的结果
with week as
(
SELECT now()::date - d AS day FROM generate_series (0, 90) as d
)
select
a.id, week.day, count(extract(dow from c.inserted_at))
from week
left join conversations c on week.day = c.inserted_at::date
left join apps a on c.app_id = a.id
group by a.id, week.day
order by week.day;
你可以举个例子吗?我不能删除ID,因为否则它会抱怨它没有在聚合函数中使用 – Tarlen