On Oct 15, 4:19 pm, refreegrata <[email protected]> wrote: > Hello, how can i get fields from different tables related for a > foreign key? > > When I do a inner join like > > AA.objects.filter(bb__field = ...) ... > > I just can access to the AA fields, and not to fields in the other > table > > in a normal query i can do something like "select AA.*, BB.* FROM. AA > inner join BB..." > but in django the resultant query is "select AA.* FROM. AA inner join > BB..." > > Now i use select_related for solve this problem isn't recommended , > because this query has an impact in the server performance. How i can > solve this? > > Thanks for read, and sorry for my poor english.
select_related *is* the answer to this question. Of cours all joins have an impact on server performance, because you're asking the database to do more work, but this is likely to be very very small, and there isn't a way of doing what you want without some form of join. -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

