I have a bug
that I do not know the reason for it.
I have in my controller
the following Eloquent
:
$balances = BankUser::select(DB::raw('SUM(balance) AS total,
created_at, DATE(created_at) AS total_at'))
->whereYear('created_at', $year)->whereMonth('created_at', $month)
>groupBy('total_at')->get();
That is generating me the following error:
SQLSTATE[42000]: Syntax error or access violation: 1055 'db_develop.account_bank_user.created_at' isn't in GROUP BY (SQL: select SUM(balance) AS total, created_at, DATE(created_at) AS total_at from
ut_banks_userwhere year(created_at) = 2018 and month(created_at) = 12 group by total_at)
But if I copy the SQL
being generated:
select SUM(balance) AS total, created_at, DATE(created_at) AS total_at from
account_bank_userwhere year(
created_at) = 2018 and month(
created_at) = 12 group by
total_at ''
And I run in my PHPMyAdmin it queries and returns the records, what is missing in the code?