Daniel Roseman wrote:
>>> Country.objects.all().extra(
>>>     where=['(SELECT COUNT(*) FROM appname_soccerteam WHERE
>>> appname_soccerteam.country_id = appname_country.id) > 0']
>>> )
>> Great idea! I did not think about the 'extra' method. Works perfectly.
>> Gave me a speedup factor of about 250k :)
>>
>> Thanks,
> 
> Alternatively you could use the normal django syntax:
> Country.objects.filter(soccerteam__name__isnull=False)

But the thing is, I can have multiple SoccerTeam relations. Doesn't that
rule out this solution?

-- 
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  |     Visit us at: http://www.gmta.info

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to