Re: count of occurences

Поиск
Список
Период
Сортировка
От Eric Ridge
Тема Re: count of occurences
Дата
Msg-id D3ADE25911614840BC69C72E3171E4ED0FBB37@tcdiexch.tcdi.com
обсуждение исходный текст
Ответ на count of occurences  (adamcrume@hotmail.com (Adam))
Список pgsql-general
> I tried
>
> select distinct job_num, (select count(*) from search_records j where
> j.job_num=k.job_num) from search_records k

can't you just do:

select job_num, count(job_num) from search_records group by job_num
order by job_num

http://www.postgresql.org/idocs/index.php?queries.html#QUERIES-GROUP

and creating an index on job_num might improve performace even more, but
I don't know if index scans are used in aggregate functions or not.

eric

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