Generates the sql for the GROUP BY portion of the query

        :return: the GROUP BY portion of the query
        :rtype: str

def build_groups(self):
        """
        Generates the sql for the GROUP BY portion of the query

        :return: the GROUP BY portion of the query
        :rtype: str
        """
        # check if there are any groupings
        if len(self.groups):
            groups = []

            # get the group sql for each grouping
            for group in self.groups:
                groups.append(group.get_name())
            return 'GROUP BY {0} '.format(', '.join(groups))
        return ''