pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Subtracting time fields
2+ messages / 2 participants
[nested] [flat]

* Subtracting time fields
@ 2002-11-01 22:05  Kevin Old <kold@carolina.rr.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kevin Old @ 2002-11-01 22:05 UTC (permalink / raw)
  To: pgsql-sql

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

Any suggestions?

Thanks,
Kevin
-- 
Kevin Old <kold@carolina.rr.com>




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Subtracting time fields
@ 2002-11-01 22:30  Bruno Wolff III <bruno@wolff.to>
  parent: Kevin Old <kold@carolina.rr.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Bruno Wolff III @ 2002-11-01 22:30 UTC (permalink / raw)
  To: Kevin Old <kold@carolina.rr.com>; +Cc: pgsql-sql

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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-11-01 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-01 22:05 Subtracting time fields Kevin Old <kold@carolina.rr.com>
2002-11-01 22:30 ` Bruno Wolff III <bruno@wolff.to>

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