On Thu, 2001-09-27 at 08:30, Vince Vielhaber wrote:
> 
> I'm trying to use an integer from a table to add/subtract time in months.
> IOW:
> 
> create table foo(nummonths int);
> 
> select now() - nummonths months;

newsroom=# select now() - interval( text(3) || ' months');
        ?column?        
------------------------
 2001-06-27 08:56:27+12
(1 row)


Crude, but hey: it works :-)

Cheers,
                                        SAndrew.
-- 
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/        PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7217    MOB: +64(21)635-694    OFFICE: +64(4)499-2267


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to