【发布时间】:2021-08-11 23:52:36
【问题描述】:
我需要每天/每周/每月获取数据。所以我使用 date_trunc() 函数来获取这种类型的记录。我进行了 psql 查询,但我需要将其转换为 typeorm 代码,因为我是 typeorm 堆栈的新手。以下是查询
select date_trunc('day', e."createdAt") as production_to_month, count(id) as count from events e
where e."createdAt" between '2021-05-10' and '2021-05-17' and e."type" = 'LOGIN'
group by date_trunc('day', e."createdAt")
order by date_trunc('day', e."createdAt") asc
需要转换一下
【问题讨论】:
标签: node.js database typescript postgresql typeorm