0

Basically , I have three tables BusinessCards ,BusinessCardsIdentifiers and Identifiers.Primary key of BusinessCards and Identifiers are stored into BusinessCardsIdentifiers . I want to find a way to write single query and find related data from all related tables.

Thanks in Advance

  • 1
    Possible duplicate of [Django .."join" query?](http://stackoverflow.com/questions/1210711/django-join-query) – Jean Jung Nov 18 '15 at 09:46

1 Answers1

2

If you want to save queries you need to prefetch the data with prefetch_related when you are using many-to-many relationship, or select_related for one-to-one or foreing key relationhip. You can specify which ones to prefetch or let Django decide.

preator
  • 984
  • 5
  • 6