Improved groupbe

According to http://dev.mysql.com/doc/refman/5.0/en/group-by-extensions.html