Re: left outer join on more than 2 tables?

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: left outer join on more than 2 tables?
Дата
Msg-id 4A38114B.7090106@gmail.com
обсуждение исходный текст
Ответ на Re: left outer join on more than 2 tables?  (Richard Broersma <richard.broersma@gmail.com>)
Ответы Re: left outer join on more than 2 tables? (UNCLASSIFIED)  ("Hall, Crystal M CTR DISA JITC" <Crystal.Hall.ctr@disa.mil>)
Re: left outer join on more than 2 tables?  (Richard Broersma <richard.broersma@gmail.com>)
Список pgsql-sql
Richard Broersma wrote:
> On Tue, Jun 16, 2009 at 1:59 PM, Carol
> Cheung<cacheung@consumercontact.com> wrote:
>   
>> I would like to find the counts of complaints by region and I would like all
>> regions to be displayed, regardless of whether or not complaints exist for
>> that region. Is left outer join what I'm looking for?
>>     
>
>    SELECT R.region_name, Count(*) AS RegionComplaints
>      FROM Region AS R
> LEFT JOIN City AS Ci
>        ON R.id = C.region_id
> LEFT JOIN Complaint AS Cm
>        ON Ci.id = Cm.city_id
>  GROUP BY R.region_name;
>
>
>   
Is there a city without a reference to region?  And wouldn't you want to 
count(cm.id)?


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

Предыдущее
От: "Hall, Crystal M CTR DISA JITC"
Дата:
Сообщение: Re: left outer join on more than 2 tables? (UNCLASSIFIED)
Следующее
От: Gavin Baumanis
Дата:
Сообщение: Re: left outer join on more than 2 tables?