Re: [SQL] avg(interval)

2006-06-26 Thread Joe
Erik Jones wrote: Well, the query is working ok numerically, but should the answer really be reported as 4 days and 33 hours? Well, the original poster didn't provide the table schema or PG version, but on PG 8.0.3 both with intervals or with differences between timestamps, the query appears

Re: [SQL] avg(interval)

2006-06-26 Thread Erik Jones
Well, the query is working ok numerically, but should the answer really be reported as 4 days and 33 hours? Erik Aaron Bono wrote: Right, the 23 is just less than 1 day, not 23 days. The good news: your query is working! -Aaron On 6/26/06, *Joe* < [EMAIL PROTECTED]

Re: [SQL] avg(interval)

2006-06-26 Thread Aaron Bono
Right, the 23 is just less than 1 day, not 23 days.The good news: your query is working!-AaronOn 6/26/06, Joe < [EMAIL PROTECTED]> wrote:Tom Lane wrote:> "Jeremiah Elliott" < [EMAIL PROTECTED]> writes:>> however if i don't average them here is what i get:>> "7 days 22:24:50.62311";"*2420">> "9 days

Re: [SQL] avg(interval)

2006-06-26 Thread Joe
Tom Lane wrote: "Jeremiah Elliott" <[EMAIL PROTECTED]> writes: however if i don't average them here is what i get: "7 days 22:24:50.62311";"*2420" "9 days 22:21:02.683393";"*2420" "23:21:35.458459";"*2420" "4 days 22:47:41.749756";"*2420" "3 days 06:05:59.456947";"*2420" which should average

Re: [SQL] avg(interval)

2006-06-26 Thread Tom Lane
"Jeremiah Elliott" <[EMAIL PROTECTED]> writes: > however if i don't average them here is what i get: > "7 days 22:24:50.62311";"*2420" > "9 days 22:21:02.683393";"*2420" > "23:21:35.458459";"*2420" > "4 days 22:47:41.749756";"*2420" > "3 days 06:05:59.456947";"*2420" > which should average to just

[SQL] avg(interval)

2006-06-26 Thread Jeremiah Elliott
I am getting some really strange query output. I am trying to average an interval. The problem is that the interval average is sometimes returning more than 24 hours for the average. query: select avg(scan_date - backflush_date) as time_diff, substring(pt_article, 1, 5) as clan, sum(qty) as unit