average/stddev on all values returned by a select distinct

Поиск
Список
Период
Сортировка
От ann hedley
Тема average/stddev on all values returned by a select distinct
Дата
Msg-id 469CBB49.8020905@ed.ac.uk
обсуждение исходный текст
Ответы Re: average/stddev on all values returned by a select distinct  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
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)


В списке pgsql-general по дате отправления:

Предыдущее
От: "Michael Nolan"
Дата:
Сообщение: Re: What's the logical counterpart of the to_hex function?
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: average/stddev on all values returned by a select distinct