joining VIEWs
От | Brian Cox |
---|---|
Тема | joining VIEWs |
Дата | |
Msg-id | 20060822164004.88034.qmail@web39806.mail.mud.yahoo.com обсуждение исходный текст |
Ответы |
Re: joining VIEWs
|
Список | pgsql-sql |
<font size="2">Given a view like:<br /><br /> create view view1 as<br /> select g.id as UserGroupId, s.uid as UserId, s.timeas StartTime from stats s join groups g on g.uid = s.uid<br /><br /> and a SELECT like:<br /><br /> select a.UserGroupId,b.UserGroupIdfrom view1 a<br /> full outer join view1 b on b.UserGroupId = a.UserGroupId<br /> WHERE a.StartTime>= '2006-1-1' AND a.StartTime < '2007-1-1'<br /> AND b.StartTime >= '2005-1-1' AND b.StartTime <'2006-1-1';<br /><br /> where there are 5695 rows in 2006 and 1 row in 2005, I expected to get a result set of 5695 rows,but instead got only 1 row (the common row in the 2 years). This seems contrary to the definition of "full outer join". Am I missing something?<br /><br /> Thanks,<br /> Brian Cox</font><p><hr size="1" />Talk is cheap. Use Yahoo! Messengerto make PC-to-Phone calls. <a href="http://us.rd.yahoo.com/mail_us/taglines/postman7/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com"> Greatrates starting at 1¢/min.</a>
В списке pgsql-sql по дате отправления: