Search Postgresql Archives

Re: Unexpected results with joins on dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12 Jul 2011, at 4:53, Tim Uckun wrote:

(Edited to take the irrelevant stuff out)

> select count(traffic.date) from traffic inner join sales on traffic.date = sales.date

> running this query gives me this result
> 25121853

> On the third select (two table join) it doesn't matter if I change it
> to a right join, full join left outer join I get the same number so it
> looks like it's doing a cross join no matter what. It also doesn't
> matter if I do a select count(*)
> 
> Could somebody explain what is happening here?


Apparently you don't have any records in traffic where there's no corresponding date in sales or vice versa.  Hence, outer joins give the same result as inner joins.

If that's not the case then we're going to need more details, such as the definitions of the tables.

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4e1c140112091081743685!



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux