pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Kevin Old <kold@carolina.rr.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: Subtracting time fields
Date: Fri, 1 Nov 2002 16:30:54 -0600
Message-ID: <20021101223054.GA2474@wolff.to> (raw)
In-Reply-To: <1036188325.6778.67.camel@oc>
References: <1036188325.6778.67.camel@oc>

On Fri, Nov 01, 2002 at 17:05:26 -0500,
  Kevin Old <kold@carolina.rr.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.



view thread (2+ messages)

Message-ID: <20021101223054.GA2474@wolff.to>
Permalink:  ../20021101223054.GA2474@wolff.to/
Also on:    postgresql.org/message-id/20021101223054.GA2474@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, kold@carolina.rr.com
  Subject: Re: Subtracting time fields
  In-Reply-To: <20021101223054.GA2474@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox