Anwering my own question... it helps to specify an actual join condition. This worked: extra['last_event_when'] = "SELECT event_loggedevent.when FROM event_loggedevent,event_eventrelation WHERE (event_eventrelation.event_id = event_loggedevent.id) AND (event_eventrelation.content_type_id = %s) AND (event_eventrelation.object_id = common_idxlead.id) ORDER BY event_loggedevent.when DESC limit 1" % ct
... off to amazon to look for a decent sql book so I can avoid asking silly questions in the future. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---