Closed Ruitjes closed 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)
SQLSTATE[42000]: Syntax error or access violation: 1463 Non-grouping field 'distance' is used in HAVING clause (SQL: select
.*, ((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 from
where
= 2 having distance BETWEEN 0 AND 10 limit 26 offset 0)
Try this? https://stackoverflow.com/questions/39053335/laravel-5-3-syntax-error-or-access-violation-1463-non-grouping-field-distance
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.
php artisan config:clear
Thanks!
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: select
ads.*, ((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 from
adswhere
category_id= 2 having distance BETWEEN 0 AND 10 limit 26 offset 0)