A simple group-by (no count) in Django
- by Daniel Quinn
If this were raw-SQL, it'd be a no-brainer, but in Django, this is proving to be quite difficult to find. What I want is this really:
SELECT
user_id
FROM
django_comments
WHERE
content_type_id = ? AND
object_pk = ?
GROUP BY
user_id
It's those last two lines that're the problem. I'd like to do this the "Django-way" but the only thing I've found is mention of aggregates and annotations, which I don't think solve this issue... do they? If someone could explain this to me, I'd really appreciate it.