i run this query on phpmyadmin database table working fine:
select substring_index( prefix, '.', 3 ) as subip , count(prefix) as count, prefix
from prefixes
GROUP BY INET_ATON(subip)/256
order by cidr desc
when i run raw query in laravel:
$selected_prefixes = DB::select("select substring_index( prefix, '.', 3 ) as subip , count(prefix) as count, prefix
from prefixes
GROUP BY INET_ATON(subip)/256
order by cidr desc ");
giving this error:
SQLSTATE[42000]: Syntax error or access violation: 1055 'portal.prefixes.prefix' isn't in GROUP BY (SQL: select substring_index( prefix, '.', 3 ) as subip , count(prefix) as count, prefix from prefixes GROUP BY INET_ATON(subip)/256 order by cidr desc )
here example table file: https://www.mediafire.com/file/vwnply7ggtai52m/prefixes(5).sql/file