Re: [SQL] left outer join on more than 2 tables?

2009-06-17 Thread Carol Cheung
On 16/06/2009 19:12, Rob Sargent wrote the following: Richard Broersma wrote: On Tue, Jun 16, 2009 at 2:40 PM, Rob Sargent wrote: Is there a city without a reference to region? I don't know, but the OP wanted to know complaints by region. I didn't try this, but with regionless

[SQL] left outer join on more than 2 tables?

2009-06-16 Thread Carol Cheung
Hi, I have 3 tables region: id region_name city: id city_name region_id complaint: id date city_id 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

[SQL] counts of groupings by date year-month

2009-02-27 Thread Carol Cheung
Hi, I have a table called temp access_date | active | status -++ 2009-02-01 | t | 15 2009-02-01 | f | 16 2009-02-02 | f | 17 2009-02-01 | t | 17 2009-02-02 | f | 21 2009-01-01 | t | 20 2009-01-01 | t

[SQL] group by range of values

2007-07-27 Thread Carol Cheung
Hello, Here's my table: db=# select * from tester order by birth_year; birth_year | salary + 1946 | 78000 1949 | 61000 1951 | 58000 1953 | 56000 1958 | 52000 1962 | 5 1965 | 45000 1967 | 6 1968 |