How do I express this SQL query in a Django Queryset?
SELECT * FROM Table1, Table2 WHERE Table1.id_table2 = Table2.id_table2;
Be aware that the structure of table1 implyes a id_table2 foreign key...
Why? Because I want to replace the id_table2 in the Table1 table1.object.all() listing with values asociated to the register involved in the relation. Like this
Whithout relationship
| id_table1 | id_table2 | foo_field1 | bar_field1 |
---------------------------------------------------
| 1 | 1 | foo1 | foo2 |
---------------------------------------------------
With Relationship
| id_table1 | foo_field2*| foo_field1 | bar_field1 |
----------------------------------------------------
| 1 | foo2 | foo1 | foo2 |
----------------------------------------------------
*: foo_field2 means not only this related field, but all related fields of that register.
Thanks in advance!!!!