Search Postgresql Archives

average/stddev on all values returned by a select distinct

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

 



I have this query which returns the length of the longest consensus for each id.

lumbribase=# select distinct on (id) length(consensus) from cluster order by id,length(consensus) desc;
length
--------
   647
   680
   273
   384
  1285
<snip>

What I want is the average and stddev of the set of lengths returned by this query. Something like...

select average(select distinct on (id) length(consensus) from cluster order by id,length(consensus) desc);

Could someone tell me how it's done?

Thanks

--
Ann

"In a world without walls and fences - who needs Windows and Gates ?"
                                                          (unknown)



[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