PostgreSQL
 sql >> Datenbank >  >> RDS >> PostgreSQL

Sekunden aus Intervalltabelle extrahieren / Datensatz in Intervall umwandeln?

Entweder das

SELECT EXTRACT(epoch from dt)
from (
    SELECT time_col - lag(time_col) OVER (ORDER BY whatever) dt
    FROM myTable
    where conditions
) as dt

Oder das

SELECT
    extract(epoch from time_col - lag(time_col) OVER (ORDER BY whatever))
FROM myTable
where conditions