Re: Unexpected results when joining on date fields

From: Alban Hertroys
Subject: Re: Unexpected results when joining on date fields
Date: ,
Msg-id: 980063D6-C221-4083-BB45-3B5DC55E364A@solfertje.student.utwente.nl
(view: Whole thread, Raw)
In response to: Unexpected results when joining on date fields  (Tim Uckun)
List: 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 by date:

From: Tim Uckun
Date:
Subject: Re: Unexpected results with joins on dates
From: Craig Ringer
Date:
Subject: Re: Fw: Re: [BUGS] BUG #6099: Does pgcluster support hibernate?