diff --git a/db/models/sql/compiler.py b/db/models/sql/compiler.py
index eaf2cd2..be1b9d8 100644
a
|
b
|
class SQLCompiler(object):
|
90 | 90 | if not self.connection.features.allows_group_by_pk: |
91 | 91 | for col, col_params in ordering_group_by: |
92 | 92 | if col not in grouping: |
93 | | grouping.append(str(col)) |
94 | | gb_params.extend(col_params) |
| 93 | for order in ordering: |
| 94 | if col in order: |
| 95 | ordering.remove(order) |
95 | 96 | else: |
96 | 97 | ordering = self.connection.ops.force_no_ordering() |
97 | 98 | result.append('GROUP BY %s' % ', '.join(grouping)) |