mercredi 21 décembre 2016

My query should return the sum of users per month and not count of users per month

 return User::thisYear()
            ->selectRaw('DATE_FORMAT(created_at, "%m") as month, COUNT(*) as people')
            ->groupBy('month')
            ->pluck('people', 'month');

My query should return the sum of users per month and not count of users per month So if i have 1 user first month and 2 users second month then the second month should show 3 users total.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire