Search Postgresql Archives

Re: Unexpected results when joining on date fields

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

 



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? Just joining 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!



-- 
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