Re: adding years to a date field
От | Christine Penner |
---|---|
Тема | Re: adding years to a date field |
Дата | |
Msg-id | 4D9C9247.5010308@fp2.ca обсуждение исходный текст |
Ответ на | Re: adding years to a date field (Adrian Klaver <adrian.klaver@gmail.com>) |
Ответы |
Re: adding years to a date field
Re: adding years to a date field |
Список | pgsql-general |
This still gave me a sytax error. The other suggestion to multiply the interval field by 1 year also gave me a syntax error.
ii_purchased is a timestamp without time zone
ii_expected_life is a smallint
Any other suggestions?
On 06/04/2011 9:05 AM, Adrian Klaver wrote:
ii_purchased is a timestamp without time zone
ii_expected_life is a smallint
Any other suggestions?
Christine Penner Ingenious Software 250-352-9495 chris@fp2.ca
On 06/04/2011 9:05 AM, Adrian Klaver wrote:
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@fp2.ca
В списке pgsql-general по дате отправления: