Find difference between timestamps in seconds in PostgreSQL

后端 未结 3 1727
遇见更好的自我
遇见更好的自我 2020-12-02 08:57

I have a table in PostgreSQL 8.3 with 2 timestamp columns. I would like to get the difference between these timestamps in seconds. Cou

3条回答
  •  温柔的废话
    2020-12-02 09:24

    SELECT (cast(timestamp_1 as bigint) - cast(timestamp_2 as bigint)) FROM table;
    

    In case if someone is having an issue using extract.

提交回复
热议问题