From: | Osvaldo Rosario Kussama <osvaldo_kussama(at)yahoo(dot)com(dot)br> |
---|---|
To: | chrisj <chrisj(dot)wood(at)sympatico(dot)ca>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: date arithmetic |
Date: | 2006-08-10 19:21:07 |
Message-ID: | 44DB8723.6020401@yahoo.com.br |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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 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"
SELECT col1 + col2*interval '1 miunute' FROM bob;
[]s
Osvaldo
_______________________________________________________
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale
o discador agora!
http://br.acesso.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Mair | 2006-08-10 19:25:20 | Re: Querying constraints? |
Previous Message | Andrew Hammond | 2006-08-10 13:28:30 | Re: timestamp (MS SQLServer's rowversion) functionality |