Included 'group by' function

Included a function to allow a 'group by' condition to be constructed
with the mysql query

The modifications I have made seem to be working well for me, and wanted to share the changes with everybody :)

This is my first pull request, so if I'm missing something just let me know!