Fixed mysql "group by" clause not working when trying to group with multiple fields