date arithmetic with columns

Поиск
Список
Период
Сортировка
От Peter Faulks
Тема date arithmetic with columns
Дата
Msg-id 4F4E818F.9030402@iinet.net.au
обсуждение исходный текст
Ответы Re: date arithmetic with columns  (Peter Faulks <faulksp@iinet.net.au>)
Список pgsql-sql
I have two columns in two distinct tables, one is the starting time of 
an event, timestamp without time zone. Data is the utc datetime (for 
sorting across time zones), the other is the number of minutes to add.

I am migrating from Firebird. One of the queries uses the dateadd 
function to build a local starting time thus:

SELECT CAST(DATEADD(tz.diffmins MINUTE TO r.utc) AS TIME) AS ts
FROM races r JOIN tracks t ON t.trk = r.trk             JOIN timezones tz on tz.state = t.state....

The equivalent postgres would be along the lines of

SELECT r.utc + INTERVAL '480 minutes'

How can I substitute the hard-coded 480 for the tz.diffmins?



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

Предыдущее
От: Samuel Gendler
Дата:
Сообщение: Re: How To Create Temporary Table inside a function
Следующее
От: Peter Faulks
Дата:
Сообщение: Re: date arithmetic with columns