Re: Subtracting time fields

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Kevin Old <kold(at)carolina(dot)rr(dot)com>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Subtracting time fields
Date: 2002-11-01 22:30:54
Message-ID: 20021101223054.GA2474@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Nov 01, 2002 at 17:05:26 -0500,
Kevin Old <kold(at)carolina(dot)rr(dot)com> wrote:
> Hello all,
>
> I have two fields in my database access_time and release_time.....I
> would like to calculate the "duration" between these two values, but
> can't figure out what to do.
>
> I've tried something like this but it doesn't work:
>
> select access_time, release_time, time(access_time) - time(release_time)
> as duration from mastertbl limit 10

You should be able to just subtract release_time from access_time without
trying to call the time function. The type of the difference will be
an interval.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-11-01 22:36:32 Re: making queries more effecient
Previous Message Peter T. Brown 2002-11-01 22:24:52 making queries more effecient