【发布时间】:2016-09-15 16:24:29
【问题描述】:
所以我想查询一个结构是这样的考勤表
employeeId | clockInTime| clockOutTime
-----------+------------+--------------
555 | 1462797450 | 1462785465
555 | 1462883850 | 1462871850
111 | 1463056650 | 1463044650 <== skip this
555 | 1463143050 | 1463131050 <== get this
555 | 1463229426 | 1463245655 <== but not this
我要做的是选择两个值之间的所有行,但也选择该员工的那组行之后的下一行,无论值如何
这是我的查询
select "clockInTime", "clockOutTime", lead("clockInTime",1)
from "timeCard"
where "clockInTime" between 1462797450 and 1462883850
and "employeeId" = 555
但我收到此错误:
错误:函数前导(bigint,整数)不存在
但是当我从lead() 中删除双引号时,我最终只会得到这个,因为我的列名是驼峰式:
错误:“时钟时间”列不存在
我正在使用 node.js 和 node-pg 客户端。
【问题讨论】:
标签: sql node.js postgresql node-postgres