Thanks, Harald. I'll experiment with this approach!
J
--------------------------------------------------------------
You need a helper table containing just the numbers 0..N, where N is
greater than the maximum number of days in the query above. For
example:
CREATE TABLE seq (val INT NOT NULL PRIMARY KEY);
INSERT INTO seq (val) VALUES (0), (1), (2), (3), (4), (5), (6), (7),
(8), (9);
Then you can use a LEFT JOIN:
SELECT <start_date> + INTERVAL val DAY AS hit_date,
COUNT(hit_date) AS hit_count
FROM seq
LEFT OUTER JOIN tbl1 ON to_days(hit_date) = to_days(<start_date>) +
val
WHERE val BETWEEN 0 AND <num>
GROUP BY val
where <num> is the number of days between <start_date> and <end_date>.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php