Search Postgresql Archives

Re: optimize/cleanup SQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 29 May 2009 08:13:32 -0500 (CDT)
Brandon Metcalf <brandon@xxxxxxxxxxxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux