Re: Unexpected results when joining on date fields

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Unexpected results when joining on date fields
Дата
Msg-id 980063D6-C221-4083-BB45-3B5DC55E364A@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на Unexpected results when joining on date fields  (Tim Uckun <tim@basediary.com>)
Список pgsql-general
On 11 Jul 2011, at 1:58, Tim Uckun wrote:

> I have two tables, traffic and sales. Each one has a date field and
> lists the traffic and sales broken down by various parameters
> (multiple rows for each date).
>
> If I run  select (select count(*) from traffic) as traffic, (select
> count(*) from sales) as sales; I get the following  49383;167807
>
> if I run   select count(*) from traffic t inner join sales s on t.date
> = s.date  I get 24836841.


Perhaps you also want to filter that join so that you don't get matches for different articles sold at the same date?
Justjoining on date doesn't seem to make a whole lot of sense. 

Alban Hertroys

--
The size of a problem often equals the size of an ego.



!DSPAM:737,4e1c7f0c12096580658153!



В списке pgsql-general по дате отправления:

Предыдущее
От: Tony Wang
Дата:
Сообщение: Weird problem that enormous locks
Следующее
От: Vick Khera
Дата:
Сообщение: Re: Anyone using silent_mode?