Re: [SQL] time interval math

2012-02-13 Thread Jasen Betts
On 2012-02-09, Edward W. Rouse wrote: >> the operation abs() is meaninless on the type interval >> eg: what is abs( '1 month - 32 days + 24 hours'::interval ) > > If you need to add 30 intervals together, then +- is not meaningless. if you stop reading after one line you miss the answer. --

Re: [SQL] time interval math

2012-02-09 Thread Edward W. Rouse
> -Original Message- > From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql- > ow...@postgresql.org] On Behalf Of Jasen Betts > Sent: Thursday, February 09, 2012 6:37 AM > To: pgsql-sql@postgresql.org > Subject: Re: [SQL] time interval math > > On 2012-02-08

Re: [SQL] time interval math

2012-02-09 Thread Jasen Betts
On 2012-02-08, Edward W. Rouse wrote: > I'm still working on getting this to work, but the summary is this: > > I am getting several (many) intervals of hour, minutes and seconds. I need a > sum of the absolute value these intervals, similar to the SUM(ABS()) > function for numbers; and I need to

Re: [SQL] time interval math

2012-02-08 Thread Tim Landscheidt
"Edward W. Rouse" wrote: > Hehe, thanks, I played around and ended up with this: > round(SUM(extract('epoch' from (time_out - time_in > I will have to do the division outside of the query, but that's really a > minor issue. You can always use subqueries. > Knowing the total i

Re: [SQL] time interval math

2012-02-08 Thread Edward W. Rouse
3600 + ":" + a / 60 + ":" + a % 60) > -Original Message- > From: Steve Crawford [mailto:scrawf...@pinpointresearch.com] > Sent: Wednesday, February 08, 2012 3:26 PM > To: Edward W. Rouse > Cc: pgsql-sql@postgresql.org > Subject: Re: [SQL] time inter

Re: [SQL] time interval math

2012-02-08 Thread Steve Crawford
On 02/08/2012 12:01 PM, Edward W. Rouse wrote: I'm still working on getting this to work, but the summary is this: I am getting several (many) intervals of hour, minutes and seconds. I need a sum of the absolute value these intervals, similar to the SUM(ABS()) function for numbers; and I need to

[SQL] time interval math

2012-02-08 Thread Edward W. Rouse
I'm still working on getting this to work, but the summary is this: I am getting several (many) intervals of hour, minutes and seconds. I need a sum of the absolute value these intervals, similar to the SUM(ABS()) function for numbers; and I need to divide this sum by an integer (bigint). Getting