Re: [GENERAL] Unexpected results when joining on date fields

2011-07-12 Thread Alban Hertroys
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

Re: [GENERAL] Unexpected results when joining on date fields

2011-07-12 Thread Rick Genter
I don't think you understand what JOIN does. Think of it as a double-nested FOR loop: for each record that has the value on the left side of the JOIN, it will match all records on the right side of the JOIN that meet the ON criteria. For example, if I have two tables: A (i int, j int): i j

[GENERAL] Unexpected results when joining on date fields

2011-07-12 Thread Tim Uckun
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