title: How to get last 12 months data and insert 0 if no data found for the month
body: <p>I'm trying to get last 12 months data in Mysql using below query but i'm getting all the data not last 12 months data i gone through few of the post but helpful
  My CreatedDate format is like '2020-04-17 12:03:59'</p>
  
  <pre><code>SELECT date_format(createdDate,'%m') as Month, 
         count(*) as count, 
         date_format(createdDate,'%Y') as Year 
  FROM tablename 
  WHERE DATE_ADD(Now(),INTERVAL- 12 MONTH) 
  GROUP BY Year,
           Month 
  ORDER by Year desc,
           Month desc;
  
  </code></pre>
  
  <p>and also need help you Insert 0 if no data found in that month.</p>