So I'm trying to query a time card table whose structure is like this
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
What I'm trying to do is select all rows between two values but also the next row after that group of rows for that employee regardless of the value
This is my query
select "clockInTime", "clockOutTime", lead("clockInTime",1)
from "timeCard"
where "clockInTime" between 1462797450 and 1462883850
and "employeeId" = 555
but I get this error:
error: function lead(bigint, integer) does not exist
But when I remove the double quotes from lead()
I only end up getting this because my column names are camelCase:
error: column "clockintime" does not exist
I'm using node.js and the node-pg client.