Re: Help with subselect (first time)
От | Rodolfo J. Paiz |
---|---|
Тема | Re: Help with subselect (first time) |
Дата | |
Msg-id | 1107560787.5469.122.camel@rodolfo.gt.factorrent.com обсуждение исходный текст |
Ответ на | Help with subselect (first time) ("Rodolfo J. Paiz" <rpaiz@simpaticus.com>) |
Список | pgsql-novice |
On Thu, 2005-02-03 at 13:04 -0600, Rodolfo J. Paiz wrote: > I will guess in advance that I'm missing something obvious, but I > *think* I need a subselect here and I've never done those. Following up on this thread, I've decided that it's impossible to use a subselect for this purpose. Wrong tool. Now investigating joins... For simplicity's sake's, let's say I have a query which returns this: | month | days | |-----------|------| | 2005-01 | 31 | |-----------|------| | 2005-02 | 28 | |-----------|------| | 2005-03 | 31 | |-----------|------| And I have a second query which returns this: | month | flts | |-----------|------| | 2005-01 | 11 | |-----------|------| | 2005-03 | 8 | |-----------|------| Is there a simple way to join those two result sets into one? What I'd like to have is this: | month | days | flts | |-----------|------|------| | 2005-01 | 31 | 11 | |-----------|------|------| | 2005-02 | 28 | 0 | |-----------|------|------| | 2005-03 | 31 | 8 | |-----------|------|------| Since I'm not always able to fly every month, the "flts" result set will not have data for every month. In that case, I'd like to show a zero value as shown above. Can someone point me to the right part of the manual to read? Thanks! Cheers, -- Rodolfo J. Paiz <rpaiz@simpaticus.com>
В списке pgsql-novice по дате отправления: