Re: Having trouble with Interval computation

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Jim Ballard <jballard(at)netezza(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Having trouble with Interval computation
Date: 2001-07-16 20:50:41
Message-ID: Pine.LNX.4.30.0107162248190.680-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jim Ballard writes:

> I'd like to get the difference between two timestamp columns expressed
> as an interval with units "year to month." I believe the standard way
> to express this is as:
>
> (timestamp1 - timestamp2) year to month

timestamp1 - timestamp2

The units of the interval are calculated automatically.

> But this gives me a syntax error at "year". I also can't find a way
> to cast this to the desired interval units.

extract, date_part, date_trunc are available.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nils Zonneveld 2001-07-16 21:08:39 Re: Postmaster
Previous Message Peter Eisentraut 2001-07-16 20:03:50 Re: [HACKERS] Translators wanted