Read data from different tables

vi vismay 04 Mar, 2018
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.
​
​
Read data from different tables image 1Read data from different tables image 2Read data from different tables image 3Read data from different tables image 4
Max_admin Max_admin 25 Mar, 2018
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, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.