adding years to a date field

From: Christine Penner <chris(at)fp2(dot)ca>
To: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: adding years to a date field
Date: 2011-04-06 15:54:52
Message-ID: 4D9C8CCC.9000508@fp2.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

--
Christine Penner
Ingenious Software
250-352-9495
chris(at)fp2(dot)ca

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2011-04-06 16:04:42 Re: temp tables not dropping at end of script
Previous Message Davenport, Julie 2011-04-06 15:47:55 Re: temp tables not dropping at end of script