Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 64FF5475AEC for ; Fri, 1 Nov 2002 17:21:32 -0500 (EST) Received: from wolff.to (unknown [66.93.197.35]) by postgresql.org (Postfix) with SMTP id B3051474E44 for ; Fri, 1 Nov 2002 17:21:31 -0500 (EST) Received: (qmail 2524 invoked by uid 500); 1 Nov 2002 22:30:54 -0000 Date: Fri, 1 Nov 2002 16:30:54 -0600 From: Bruno Wolff III To: Kevin Old Cc: pgsql-sql Subject: Re: Subtracting time fields Message-ID: <20021101223054.GA2474@wolff.to> Mail-Followup-To: Kevin Old , pgsql-sql References: <1036188325.6778.67.camel@oc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1036188325.6778.67.camel@oc> User-Agent: Mutt/1.3.25i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/26 X-Sequence-Number: 10168 On Fri, Nov 01, 2002 at 17:05:26 -0500, Kevin Old 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.