Open GoogleCodeExporter opened 8 years ago
Quick correction. The error seems to only occur when attempting to slice the
result set, like when attempting to get the top 10 results.
Person.objects.annotate(num_shoes=Count('shoes')).order_by('num_shoes')[:10]
Original comment by Tojiro@gmail.com
on 14 Dec 2010 at 5:17
Tojiro,
The problem is due to the fact that MS SQL doesn't allow you to use column
aliases in the ORDER BY clause which is needed when you want to take a slice.
Apply the attached patch to sql_server/pyodbc/query.py
This is an ugly patch but it works.
Original comment by czamb...@gmail.com
on 8 Jan 2011 at 12:16
Attachments:
Original comment by vcc.ch...@gmail.com
on 24 Mar 2011 at 4:53
Original issue reported on code.google.com by
Tojiro@gmail.com
on 14 Dec 2010 at 5:11