Re: Left Outer Join Question

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: Left Outer Join Question
Дата
Msg-id GNELIHDDFBOCMGBFGEFOGEJCCBAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: Left Outer Join Question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
> "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> > What's probably happening is that count isn't counting NULLs?
> 
> As per spec.  If you want to count records independently of whether
> any particular column is NULL or not, use count(*).  See the docs,
> notably
> http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/sql-ex
> pressions.html#SYNTAX-AGGREGATES

OK, Edward - I guess Tom means do this?:

select category.name, count(items.*) 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;

Chris



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

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