Re: Having trouble with Interval computation - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: Having trouble with Interval computation
Date
Msg-id Pine.LNX.4.30.0107162248190.680-100000@peter.localdomain
Whole thread Raw
In response to Having trouble with Interval computation  ("Jim Ballard" <jballard@netezza.com>)
List 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@gmx.net   http://funkturm.homeip.net/~peter


pgsql-general by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Translators wanted
Next
From: Peter Eisentraut
Date:
Subject: Re: Postmaster