with min as
(
select
cast(extract(epoch from time) as integer)
from records
where time >= '2016-01-01 06:36:12'
order by time asc
limit 1
), max as (
select
cast(extract(epoch from time) as integer)
from records
where time <= '2016-02-01 06:36:12'
order by time desc
limit 1
)
select (max.time - min.time) t1
SQL Error [42P01]: ОШИБКА: таблица "max" отсутствует в предложении FROM
Позиция: 333
with min as
(
select
cast(extract(epoch from time) as integer) as time
from records
where time >= '2016-01-01 06:36:12'
order by time asc
limit 1
), max as (
select
cast(extract(epoch from time) as integer) as time
from records
where time <= '2016-02-01 06:36:12'
order by time desc
limit 1
)
select (max.time - min.time) t1
from min, max