Included 'group by' function

Included a function to allow a 'group by' condition to be constructed
with the mysql query