Hi, I would like to read data from different table that have a certain relation.
The final result must be a table that shows values from different table related with a certain value.
model1.name, model2.email, model3.id, model4.group_id
Example:
model1
read data from "content" where model1.catid:8
ok easy.
This read_data function has a second model,
model2
get "email" from "houses tab" where foreign key from "content" is "alias" with condition model1.alias:model2.hotel
ok, i retrive model2.email
from now on doesn't work anymore.
model3
get "id" from "user" where foreign key from "houses tab" is "email" with condition model2.email:model3.email
doesn't work
I would like to go further:
model4
get "user_group" from "user_group_map" where foreign key from "user" is "id" with condition model3.id:model4:user_id
In attachment the screenshot.



The final result must be a table that shows values from different table related with a certain value.
model1.name, model2.email, model3.id, model4.group_id
Example:
model1
read data from "content" where model1.catid:8
ok easy.
This read_data function has a second model,
model2
get "email" from "houses tab" where foreign key from "content" is "alias" with condition model1.alias:model2.hotel
ok, i retrive model2.email
from now on doesn't work anymore.
model3
get "id" from "user" where foreign key from "houses tab" is "email" with condition model2.email:model3.email
doesn't work
I would like to go further:
model4
get "user_group" from "user_group_map" where foreign key from "user" is "id" with condition model3.id:model4:user_id
In attachment the screenshot.




Hi vismay,
You need to use either the foreign key or the "Relation conditions", in case you use the foreign key then the foregn key value should match the "primary key" value on the related model.
Best regards
You need to use either the foreign key or the "Relation conditions", in case you use the foreign key then the foregn key value should match the "primary key" value on the related model.
Best regards
This topic is locked and no more replies can be posted.