I have a log that I want to generate reports from. It is an access log
where each row represents a "hit." One of the columns in the table is
a key and each user has a unique key. Is there a way using Django's
database API to get the count of distinct keys so I can get the number
of unique users?
Right now I have in my model...
def get_distinct_keys(self):
from django.db import connection
cursor = connection.cursor()
cursor.execute("SELECT DISTINCT key FROM log_accesslog")
rows = cursor.fetchall()
return rows
...which works fine. It seems that the Django distinct method does not
accept a column argument (why?)? Is there a cleaner way to do this?
Thanks,
Ryan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---