malhal / Laravel-Geographical

Easily add longitude and latitude columns to your records and use inherited functionality for calculating distances
MIT License
283 stars 49 forks source link

Syntax error or access violation: 1463 #16

Closed Ruitjes closed 5 years ago

Ruitjes commented 5 years ago

Laravel Framework 5.8.14 PHP 7.2.11 10.2.10-MariaDB

ERROR: SQLSTATE[42000]: Syntax error or access violation: 1463 Non-grouping field 'distance' is used in HAVING clause (SQL: selectads.*, ((ACOS(SIN(51.4691877 * PI() / 180) * SIN(ads.latitude * PI() / 180) + COS(51.4691877 * PI() / 180) * COS(ads.latitude * PI() / 180) * COS((6.08554785 - ads.longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.853159616) as distance fromadswherecategory_id= 2 having distance BETWEEN 0 AND 10 limit 26 offset 0)

malhal commented 5 years ago

Try this? https://stackoverflow.com/questions/39053335/laravel-5-3-syntax-error-or-access-violation-1463-non-grouping-field-distance

Ruitjes commented 5 years ago

Hello malhal,

Thanks for the quick response, already tried this but forgot to : php artisan config:clear ... It works now sorry for wasting your time for my stupid mistake.

Thanks!