Find and sum difference between timestamps in seconds in PostgreSQL using JOOQ
问题 This is a follow up question to another question of mine (Find difference between timestamps in seconds in PostgreSQL using JOOQ). I want to to sum the diff of TIMETRACKS.ENDTIME and TIMETRACKS.STARTTIME in seconds. It can happen that there will not be any TIMETRACKS in the database. In this case the database should return 0 instead. Thats how the TIMETRACKS table looks like: CREATE TABLE "TimeTracks" ( "id" uuid PRIMARY KEY, "startTime" timestamp NOT NULL, "endTime" timestamp, ); This is one