How can I do a GROUP BY in Django without invoking an aggregate function like Max, Sum, Avg, etc?
In my case, I have a table that has columns like { local_path, parent, grandparent }
, and I want to do SELECT local_path FROM ... WHERE grandparent = "foo" GROUP BY parent
. There will be multiple rows with a grandparent of "foo" and the same parent, but I just want one (any one) of their local_path's.
As you can see I don't want to take an aggregate value of anything. And I couldn't get distinct() to work because I want to find non-distinct local_paths.
I've searched and read the documentation without any luck. Thanks!