Re: optimize/cleanup SQL

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: Brandon Metcalf <brandon(at)geronimoalloys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: optimize/cleanup SQL
Date: 2009-05-29 13:42:38
Message-ID: 20090529154238.03308eaa@dawn.webthatworks.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 29 May 2009 08:13:32 -0500 (CDT)
Brandon Metcalf <brandon(at)geronimoalloys(dot)com> wrote:

> For some reason this doesn't give me satisfaction that it's written
> optimally, but I haven't found another way.
>
> SELECT round(CAST ((EXTRACT(EPOCH FROM clockout)
> -EXTRACT(EPOCH FROM clockin))/3600 AS NUMERIC),2) AS
> hours FROM timeclock;

satisfying?

template1=# select extract(days from ('2009-01-01'::timestamp -
'2008-01-01'::timestamp))+5::int;

?column?
----------
371
(1 row)

--
Ivan Sergio Borgonovo
http://www.webthatworks.it

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Gainty 2009-05-29 13:52:15 Re: Configure server firewall request/response
Previous Message Carlsson, Lars 2009-05-29 13:22:16 Configure server firewall request/response