> Hi everyone,
>
>....
>
> If it helps at all, this could be accomplished with the following SQL:
>
> SELECT updatee, score, id
> FROM Update
> WHERE lastUpdated = (
> SELECT max(lastUpdated)
> FROM Update as u
> WHERE u.updatee = Update.updatee)
>
> I am really stumped on how to accomplish this in Django, and would
> prefer not to use raw SQL if I can help it. Can anyone point me in the
> right direction?
>
Django's ORM is not a universal panacea for dealing with the database.
Complex things like this still require you to be able to use SQL.
Fortunately, you can use raw SQL and django's ORM to return model
instances from your raw query:
http://docs.djangoproject.com/en/1.3/topics/db/sql/
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment