i am trying to get data from a table on Weekly basis, like i want to get total number of records registered on Monday, Tuesday an so on..
I am able to create a script in mysql and it works fine, i am also attaching the screen shot with this description,
but when i try to do the same in laravel then it throws an error:
Mysql Query (works fine):
SELECT HOUR(`created_on`) AS Hour, COUNT(*) AS calls
FROM `buy_credits_requests`
GROUP BY HOUR(`created_on`)
Laravel Query (doesn't work)
$credits = \DB::table('buy_credits_requests')->where('status', '=', 1)->groupBy('Hour', 'ASC')
->get(['HOUR(created_on) AS Hour', 'COUNT(*) AS calls', 'state']);
Here is the screenshot.
Please help me to sort out this issue.
Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire