【发布时间】:2016-05-25 15:57:32
【问题描述】:
我正在尝试将以下 sql 查询翻译成 knex:
select count(*) as finished_on_time from task_history
where date = 20160303
and store_id = 2
and (schedule_start_time at time zone 'Australia/sydney' + interval '1' minute * floor (group_duration) )::time >= (finish_time at time zone 'Australia/sydney')::time
- 日期字段的格式为 yyyymmdd
这是我一直在尝试的 knex:
db.table('task_history')
.count('*')
.where({date: request.params.storeid, store_id: request.params.storeid })
??????
如您所料,我不确定使用哪个子句来处理 sql 语法 [at time zone Australia/sydney]。
我一直试图在互联网上找到任何类似的解决方案,但最终到了这里。
【问题讨论】:
标签: postgresql knex.js