Re: [SQL] date arithmetic with columns

2012-03-06 Thread Peter Faulks
Good question. I'm porting a (never actually finished) app from Firebird to Postgres. Now that I've re-read how the timestamptz (which Firebird doesn't have) actually works, I think I'll change the tables and get rid of the timezone lookup. Thanks On 4/03/2012 8:45 PM, hari.fu...@gmail.com

Re: [SQL] date arithmetic with columns

2012-03-04 Thread hari . fuchs
Peter Faulks writes: > 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. Maybe I'm missing something, but why don't you just use ti

Re: [SQL] date arithmetic with columns

2012-03-03 Thread Pavel Stehule
Hello 2012/3/1 Peter Faulks : > Bit more googling and I came up with: > > r.utc + CAST( tz.diffmins || ' ' || 'minutes' AS interval) > > It works, but is it the best way? > r.utc + tz.diffmins * interval '1 minute' regards Pavel Stehule > > On 1/03/2012 6:50 AM, Peter Faulks wrote: >> >> I ha

Re: [SQL] date arithmetic with columns

2012-03-03 Thread Peter Faulks
Bit more googling and I came up with: r.utc + CAST( tz.diffmins || ' ' || 'minutes' AS interval) It works, but is it the best way? On 1/03/2012 6:50 AM, Peter Faulks wrote: I have two columns in two distinct tables, one is the starting time of an event, timestamp without time zone. Data is the

[SQL] date arithmetic with columns

2012-03-03 Thread Peter Faulks
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

Re: [SQL] date arithmetic

2006-08-10 Thread Osvaldo Rosario Kussama
chrisj escreveu: Hi ALL, I want to do date arithmetic in SQL with a column that is integer. example create table bob ( col1 timestamp , col2 int4 ; where col2 represents a number of minutes. I want to do something like select col1 + interval col2 minutes from bob This is doable wi

[SQL] date arithmetic

2006-08-10 Thread chrisj
Hi ALL, I want to do date arithmetic in SQL with a column that is integer. example create table bob ( col1 timestamp , col2 int4 ; where col2 represents a number of minutes. I want to do something like select col1 + interval col2 minutes from bob This is doable with most other RDBM

Re: [SQL] date arithmetic over calender year boundaries

2004-04-28 Thread Bruno Wolff III
On Wed, Apr 28, 2004 at 16:12:34 +1200, Ray Jackson <[EMAIL PROTECTED]> wrote: > Hi, > > The following Postgres 7.1 query extracts aggregated data for an > arbitrary period within each year for sites in a table containing > 30 years of temperature data. It isn't completely clear what you want t

[SQL] date arithmetic over calender year boundaries

2004-04-27 Thread Ray Jackson
Hi, The following Postgres 7.1 query extracts aggregated data for an arbitrary period within each year for sites in a table containing 30 years of temperature data. topo=> \d longterm Table "longterm" Attribute | Type | Modifier ---+--+-- site