I\'m curious if there\'s any way to do a query in Django that\'s not a \"SELECT * FROM...\" underneath. I\'m trying to do a \"SELECT DISTINCT columnName F
SELECT * FROM...
SELECT DISTINCT columnName F
It's quite simple actually if you're using PostgreSQL, just use distinct(columns) (documentation).
distinct(columns)
Productorder.objects.all().distinct('category')
Note that this feature has been included in Django since 1.4