left outer join with count

Поиск
Список
Период
Сортировка
От Gary Stainburn
Тема left outer join with count
Дата
Msg-id 202005291709.16647.gary.stainburn@ringways.co.uk
обсуждение исходный текст
Ответы Re: left outer join with count  (Gábor SZŰCS <surrano@gmail.com>)
Список pgsql-sql
I have the following select:

select sj.*, sr.*, wd.doc_count from
  service_jobs sj
  left outer join service_receptions sr on sr.sr_id = sj.sj_sr_id
  left outer join (select sj_id, count(sj_id) as doc_count from work_documents wd group by sj_id) wd on wd.wd_sj_id =
sj.sj_id;

While the select works, I can't help thinking that the last join is expensive.  Is there a cleaner (quicker) method of
doingthis?
 

Gary




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

Предыдущее
От: Igor Shmukler
Дата:
Сообщение: Re: Postgres stored procedure errs while parsing JSONB object
Следующее
От: Gábor SZŰCS
Дата:
Сообщение: Re: left outer join with count