Select distinct values from a table field
Posted
by alj
on Stack Overflow
See other posts from Stack Overflow
or by alj
Published on 2010-03-17T22:56:31Z
Indexed on
2010/03/17
23:01 UTC
Read the original article
Hit count: 213
django
|django-queryset
I'm struggling getting my head around the Django's ORM. What I want to do is get a list of distinct values within a field on my table .... the equivalent of one of the following:
SELECT DISTINCT myfieldname FROM mytable
(or alternatively)
SELECT myfieldname FROM mytable GROUP BY myfieldname
I'd at least like to do it the Django way before resorting to raw sql.
© Stack Overflow or respective owner