Hi,

I am using a combination of the only() and distinct() functions on a
model to get the unique values of one column. Sadly, the only()
function also includes the primary key (even though I only give one
column name), which has the effect that all rows are seen as unique.

This is the result I want:
power_meter
1
2
3

This is the result I get:
id      power_meter
80      1
81      1
82      1
83      2
84      2
85      3
86      3

So I am wondering why the primary key is included in the query, even
though I used only('power_meter') in my query. I could just do a GROUP
BY, but alas, that's impossible with the ORM...

I am not using an ORDER BY, so that should not be the reason the
primary key is included.

Thanks,
Kevin Renskers

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to