pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chrisj <chrisj.wood@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: date arithmetic
Date: Tue, 8 Aug 2006 14:27:39 -0700 (PDT)
Message-ID: <5715425.post@talk.nabble.com> (raw)


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 RDBMS (DB2, Oracle MS SQL) what am I
missing??

I know one option is to create col2 as interval, but does not work for me.
How can I cast int4 to "interval minutes"
-- 
View this message in context: http://www.nabble.com/date-arithmetic-tf2075353.html#a5715425
Sent from the PostgreSQL - sql forum at Nabble.com.




view thread (2+ messages)  latest in thread

Message-ID: <5715425.post@talk.nabble.com>
Permalink:  ../5715425.post@talk.nabble.com/
Also on:    postgresql.org/message-id/5715425.post@talk.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chrisj.wood@sympatico.ca
  Subject: Re: date arithmetic
  In-Reply-To: <5715425.post@talk.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox