I have two tables, say T_A and T_B, and they have their own models. Two tables have correlations but don't have something like has_many belongs_to and they're not allowed to have those explicit correlations, so we can't use joins.
The relation between them, say from field_A1 of T_A, we have a field_B1 of T_B to map it, and we want to have field_A1 and field_B2 of two tables.
If we are using raw sql query, it will simply be:
select T_A.field_A1, T_B.field_B2 where T_A.field_A1=T_B.field_B1
But, how to do this without using raw SQL query? Thanks!
Aucun commentaire:
Enregistrer un commentaire