select_related() and RawQuerySet

2012-03-02 Thread Tom Evans
Hi all I have a particular query that requires me to use a RawQuerySet - I need to left join the table to itself in order to select the highest 'priority' row from the table for each distinct value of a foreign key on the model, and I need to join to the related table in order to filter the result

Re: select_related() and RawQuerySet

2012-03-02 Thread akaariai
On Friday, March 2, 2012 7:24:00 PM UTC+2, Tom Evans wrote: > > Hi all > > I have a particular query that requires me to use a RawQuerySet - I > need to left join the table to itself in order to select the highest > 'priority' row from the table for each distinct value of a foreign key > on the mod

Re: select_related() and RawQuerySet

2020-04-27 Thread Alex Scott
This is an insanely old thread, but I couldn't find any updates so was curious if anyone had advice on implementing select_related with a RawQuerySet? It seems prefetch_related() works just fine. On Friday, March 2, 2012 at 11:22:52 AM UTC-8, akaariai wrote: > > On Friday, March 2, 2012 7:24:00