I have a very, VERY weird issue. Our team has ignored this for a while because it hasn't broken anything (I know, not a good attitude), but I really want to know what the hell is/could be going on. We are on Laravel 5.2.
We have built very long queries using the laravel eloquent query builder. For some reason, sometimes, when we do a toSql(), we'll get the query we meant to run. When pasting the query, I'll get an error like this one:
Error Code: 1055. Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'onion.distance' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Weird part though, changing nothing about it, laravel will run the query just fine! Anyone have ANY idea why laravel would run the query fine, but the toSql out put trigger this error? And how could we avoid it (other than manually adding the Group By's).
Not pasting code unless requested (lots of moving parts to some of the queries).