Re: Left Outer Join Question

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Left Outer Join Question
Дата
Msg-id GNELIHDDFBOCMGBFGEFOCEJCCBAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Left Outer Join Question  (Edward Murray <mail@avenuedesign.net>)
Ответы Re: Left Outer Join Question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
> select category.name, count(items.recordnum) from category left outer join
> items on (category.recordnum = items.catnum) where category.recordnum =
> section_subcats.catnum and section_subcats.sectionnum = 1 and
> items.clientnum = 333 group by category.name;

Try using:

count(coalesce(items.recordnum, 0))

instead of:

count(items.recordnum)

I can't guarantee that it will work - I haven't tried it myself.  What's
probably happening is that count isn't counting NULLs?

Chris



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

Предыдущее
От: Edward Murray
Дата:
Сообщение: Left Outer Join Question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Timestamp output