group_table function

Group the records in the table