Re: left outer join on more than 2 tables?

Поиск
Список
Период
Сортировка
От Richard Broersma
Тема Re: left outer join on more than 2 tables?
Дата
Msg-id 396486430906161425i1cb7949enff5443cc2043805a@mail.gmail.com
обсуждение исходный текст
Ответ на left outer join on more than 2 tables?  (Carol Cheung <cacheung@consumercontact.com>)
Ответы Re: left outer join on more than 2 tables?  (Rob Sargent <robjsargent@gmail.com>)
Re: left outer join on more than 2 tables?  (Gavin Baumanis <gavinb@eclinic.com.au>)
Список pgsql-sql
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_idGROUP BY R.region_name;


-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug


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

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