Re: Unexpected results with joins on dates

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Unexpected results with joins on dates
Дата
Msg-id 1F0CD903-554C-4035-9931-C2382869F336@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Unexpected results with joins on dates  (Tim Uckun <timuckun@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: ? about Composite Keys + ON DELETE/UPDATE SET NULL
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: [HACKERS] Creating temp tables inside read only transactions