<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_count_query(self):
 """ Copies the query object and alters the field list and order by to do a more efficient count """

        query_copy = self.copy()
        if not query_copy.tables:
            raise Exception('No tables specified to do a count')

        for table in query_copy.tables:
            del table.fields[:]

        query_copy.tables[0].add_field(CountField('*'))
        del query_copy.sorters[:]
        return query_copy