lundi 20 avril 2015

Postgresql using date interval and SELECT statement

I have a table with 3 columns - a timestamp, a real, and a string. The String columns holds various time frequency values (like Minutes, Hours, Days). I want to take the value in my timestamp column and add to it the values in the other columns. For example I'd like to do something like

select timestamp '2015-04-20 01:00' + interval '2 hours'

if I had a table with the following columns and values

'action_start_time' =  '2015-04-20 01:00'

'rate' = 2

'frequency' = hours

Aucun commentaire:

Enregistrer un commentaire