Search Postgresql Archives

Re: adding years to a date field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/06/2011 08:54 AM, Christine Penner wrote:
I have to add a number of years to a date field. The years come from
another field in the table.

I know I can do this:
select (ii_purchased + interval '3 year') as date from inventory_item;

But I need to replace the 3 in 3 years with another field from the same
table ii_expected_life but I can't seem to do that without getting
syntax errors

Maybe something along lines:
select (ii_purchased + interval year_int::text||' year') as date from inventory_item

I am guessing at the data type of the field.


--
Christine Penner
Ingenious Software
250-352-9495
chris@xxxxxx



--
Adrian Klaver
adrian.klaver@xxxxxxxxx

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux