title: Query to get data day by day or month by month etc ? in grails
body: <p>I want to draw some charts in my grails application, but before this I must get the data to feed the chart from the data base, but I still can’t figure out how to get that data that I need with the correct method.</p>
  
  <p>I have a start Date and an end Date that limit the period and I want to get Data by day or week, month, year, etc.  </p>
  
  <p>I think of making a loop from start Date to end Date with step with step equal to one day /week /month /year etc.</p>
  
  <p>Do you think this is the right approach? if yes how to write this in groovy  , if no please tell how to do this the right way </p>
  
  <p>Thanks</p>