lundi 30 octobre 2017

Convert raw MySQL into Laravel 5 query

select calendars.datefield AS date,
ifnull(sum(sales.sale_total),0) as total
from sales 
right join calendars on (date(sales.created_at) = calendars.datefield)
where (calendars.datefield between (select min(date(created_at)) from sales) and (select max(date(created_at)) from sales))
group by date

Want to convert it into Laravel 5 query. I am running Laravel 5.4. Any help?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire