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?
Re: left outer join on more than 2 tables? |
Список | 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 по дате отправления: