Performance::thisYear()
->selectRaw('DATE_FORMAT(created_at, "%m") as month, sum(amount) as revenue')
->groupBy('month')
->pluck('revenue');
Edit lowercase 'm' for month as padded digits
Hi,
In the chart.js series, @jeffery_way used sqlite and wrote this
Preformance::thisYear() ->selectRaw('strftime("%m", created_at) as month, sum(revenue) as revenue') ->groupBy('month') ->pluck('revenue'); https://laracasts.com/series/charting-and-you/episodes/6 to get the sum of transactions within the last year, grouped by months.
I am trying to do something similar in a real life project, what is the mysql equivalent of this..?
Performance::thisYear()
->selectRaw('DATE_FORMAT(created_at, "%m") as month, sum(amount) as revenue')
->groupBy('month')
->pluck('revenue');
Edit lowercase 'm' for month as padded digits
Please or to participate in this conversation.