title: how i can get last 10 days records with mysql?
body: <p>my table structure was like </p>
  
  <pre><code>CREATE TABLE `survey` (
    `id` int(11) NOT NULL auto_increment,
    `submitdate` datetime default NULL,
   `answer` varchar(5) collate utf8_unicode_ci default NULL,
    PRIMARY KEY  (`id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=499 ;
  </code></pre>
  
  <p>Now I want to calculate last 10 days records. Suppose no record on particular day. it should be zero.</p>
  
  <p>the output is like </p>
  
  <pre><code>date         count
  19-11-2012   10
  18-11-2012   30 
  13-11-2012   0 
        .
        .
  </code></pre>
  
  <p>i have used query  like </p>
  
  <pre><code>SELECT COUNT( * ) , DATE( submitdate ) 
  FROM survey t
  WHERE t.submitdate &gt;= ( CURDATE( ) - INTERVAL 10 
  DAY ) 
  GROUP BY DATE( submitdate ) 
  LIMIT 0 , 30
  </code></pre>
  
  <p>output is </p>
  
  <pre><code>count(*)    date(submitdate)
  1   2012-11-13
  2   2012-11-14
  1   2012-11-15
  3   2012-11-16
  6   2012-11-17
  </code></pre>
  
  <p>not giving 0 for no records with dates. </p>