I have the following query
:
SELECT count(id_estadistica) AS num_clicks, a.*, b.* FROM estadisticas AS a LEFT JOIN noticias AS b ON a.id_elemento = b.id_noticia
WHERE b.id_noticia IS NOT NULL AND b.fecha_pub BETWEEN '2017-10-01 00:00:01' AND '2017-10-31 23:59:59'
GROUP BY a.id_elemento
ORDER BY num_clicks
DESC LIMIT 0, 20;
The problem is that when executing it, mysql
returns this error:
# 1055 - Expression # 2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.id_estadistica' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode = only_full_group_by
I used to have version 5.5 of mysql and it worked well for me. The problem is that my server provider does not give me the option to go back in the version.
And I can not execute querys
of the type:
set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
Because I get this error:
# 1227 - Access denied. You need the SUPER privilege for this operation
Is there a way to fix it without changing the version of mysql?