hello adrian wrote: > > I've got a table of species sightings. > I need a query that returns the latest sighting for each species. > I believe this would normally require GROUP BY but I > am trying to avoid raw SQL. > > Could I do the query without the GROUP BY, and then > modify the queryset results using Python to eliminate rows except the > ones with the latest date for > each species? I guess I would use iterator(). But I am not clear > on how to use that - there are no examples. > > With raw SQL it's a headache to get the results in a format that > I can pass to a template when I also want to be able to pass normal > QuerySets to that same template.
have a look @ http://docs.djangoproject.com/en/dev/topics/db/queries/ goodluck
smime.p7s
Description: S/MIME Cryptographic Signature

