mardi 22 mars 2016

Get all orders between two dates per day

Lets say i have 3 orders in my database

  1-1-16
  1-4-16
  1-15-16

What i want to do is show a graph with orders per day between two dates. For example

1-1-16 / 1-5-16

What i want is

 1-1-16      ,1
 1-2-16      ,0
 1-3-16      ,0
 1-4-16      ,1
 1-5-16      ,0

How should i get the data for the dates when there are no orders? I have an Order model with a created_at field where i can run the querys on.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire