Re: Unexpected results with joins on dates - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Unexpected results with joins on dates
Date
Msg-id 1F0CD903-554C-4035-9931-C2382869F336@solfertje.student.utwente.nl
Whole thread Raw
In response to Unexpected results with joins on dates  (Tim Uckun <timuckun@gmail.com>)
List pgsql-general
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,
outerjoins 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!



pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: ? about Composite Keys + ON DELETE/UPDATE SET NULL
Next
From: Alban Hertroys
Date:
Subject: Re: [HACKERS] Creating temp tables inside read only transactions