Django orm query help -


employee class has id, first_name, last_name, , lot more fields.

i want select employees not have same last_name, it's distinct in sql, how that?

employees = employee.objects.value('last_name').distinct() include last_name, cannot find id.

if employees = employee.objects.value('id', 'last_name').distinct() results.count() looks different.

that's because may have employees same last name.
when add 'id' in query, ask distincts rows based on 2 criterias, , have distinct id.
clear ?...


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -