If you require a value from both tables in the WHERE clause, you might
as well use an inner join. The left join probably IS executed, but you
filter out any empty records with your WHERE clause.
Are you sure you don't mean a right join here?
Bill wrote:> Hello,
> I've got a select statement that joins two tables.
> -- tblPageHitCalendar contains a single column holding dates. It has
> every day since our web site went live.
> -- tblPageHits has a row for every time a page was hit.
> I want this statement to tell me how many hits per day a page got in a
> specified date range. It does that, but if the page got no hits on a
> particular day, that day isn't returned. It should show the day and
> zero, but the day isn't returned at all. What have I done wrong here?
> SELECT c.hitdate,
> FROM tblPageHitCalendar c
> LEFT JOIN tblPageHits h ON c.hitdate = date_format(h.hittime,
> WHERE c.hitdate BETWEEN '2005-04-01' AND '2005-07-31 23:59:59'
> AND h.url = '/mission.php'
> GROUP BY c.hitdate