On 09/14/2011 04:35 AM, Peter of the Norse wrote:
What are you trying to do? The outer GROUP BY destroys the inner ORDER BY. Try 
putting them on the same level and see what happens.

Say I've got an Event table and some records like this

  name: foo, timestamp: 9 pm
  name: foo, timestamp: 10pm
  name: bar, timestamp: 3pm

I want the latest event for every `name`:

  name: foo, timestamp: 10pm
  name: bar, timestamp: 3pm

On PostgreSQL one could use DISTINCT ON but it's not yet supported by Django, either.

--

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

--
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to