Re: Help with SQL updating not working.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Help with SQL updating not working.
Дата
Msg-id CAKFQuwayy0KcAhaKDv4wpaALBPLcJXk040UMXxkZ7LGBwuFhVQ@mail.gmail.com
обсуждение исходный текст
Ответ на Help with SQL updating not working.  (Paul Linehan <linehanp@tcd.ie>)
Список pgsql-novice
On Mon, May 18, 2015 at 1:27 PM, Paul Linehan <linehanp@tcd.ie> wrote:

Now, into the time_diff field, I want to insert the time difference in seconds

I've tried various combinations of this

update the_times as  set time_diff = extract ('epoch' from
(the_times.time2 - the_times.time1)::interval)  from the_times;

but to no avail.

Could any kind soul help me out on this?
​​

SELECT extract('epoch' FROM te) - extract('epoch' FROM ts)
FROM (
VALUES ( '08:34:21'::time, '09:34:21'::time)
) tm (ts, te)

epoch ARE seconds; just subtract them directly.

David J.
 

В списке pgsql-novice по дате отправления:

Предыдущее
От: Daniel Begin
Дата:
Сообщение: Re: Moving Database Cluster to another drive
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Help with SQL updating not working.