Buy Now
Sign in

Read data from different tables

vismay , March 04 at 17:36
V
vismay
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.
Schermata_2018-03-04_alle_18.34.26.pngSchermata_2018-03-04_alle_18.34.20.pngSchermata_2018-03-04_alle_18.34.13.pngSchermata_2018-03-04_alle_18.34.07.png
admin
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
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!