This error came up after moving the whole source to the 5.3 version, and I'm scratching my head for over two hours now.
So I have this kind of eloquent query:
POI::select('*', DB::raw("SQRT( POW((x - {$this->x}),2) + POW((y - {$this->y}),2) ) AS distance"))
->where('status', Config::get('app.poi_state.enabled'))
->whereNotIn('id', $excludePOIList)
->having('distance', '<=', $distance)
->orderBy('distance')->get();
It worked find before upgrade now it throws:
Syntax error or access violation: 1463 Non-grouping field 'distance' is used in HAVING clause (SQL: select *, SQRT( POW((x - 860.0000),2) + POW((y - 105.0000),2) ) AS distance from
poi
wherestatus
= 1 andid
not in (1) havingdistance
<= 6 order bydistance
asc)
I wanted to check if the ONLY_FULL_GROUP_BY mode is enabled on my server, but it isn't...
SELECT @@sql_mode NO_ENGINE_SUBSTITUTION
The same query works fine in MySQL workbench. What's going on?
Check in the config/database.php file in the mysql conection that the strict is false:
'strict' => false,
If is true, put in false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With