You cannot get data out of a database if it's not in the database. If there's no data for a day, you cannot get 0 for that day, because the day does not exist in the database. You could make a "calendar" table, one row per day, and join it with a count to get 0 for the day.
-Sheeri On 5/15/06, Barry <[EMAIL PROTECTED]> wrote:
Hello everyone! The mysql documentation doesn't show any good infos er examples about writing procedures. To be more specific: I have a table with saved clicks by users. Now i want to draw a graph with a php extension. Problem is: if i let me show the clicks, one day is missing. Because on that day noone clicked on the link. I use this query: SELECT DATE(c_clicktime) AS clicktime, count(c_id) as clicks FROM clicks WHERE c_cl_id = 3 AND DATE(c_clicktime) BETWEEN '2005-01-01' AND '2005-01-20' GROUP BY clicktime The output gives me 19 entries because on the 20th January noone clicked that link. I think this have to be done with a procedure. So that my query would give a 0 (zero) for the 20th January as clicks. How would i do something like that? Thanks for your time :) Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]