Added a field to group by to avoid error with mysql strict mode