Model
ID Model
1 1
2 2
3 4
4 10
Model-table
ID model_id table_name
1 1 table1
2 3 table2
3 4 table3
Note: It is not important that every model requires table_name.
I find the table_name of model width id 3, it is table2
. It is so simple fo find it, I do not see the reason to write here my sql. After finding table2
, I should select from table2
and find all parametres. In this case I should write second sql. Here is the structure of table2
Note: We can find all parametres of model_id with 3.
table2
ID model_id param1 param2 param3
1 3 0 5 10
My question:
I am looking for the way, firstly find suitable model_id in model_table
and fetch table_name
, THEN SELECT from table_name
and fetch all parametres with 1 SQL.
Note: I have id and model_id variables on my PHP PAGE. So, we need to use Limit 1 and fetch suitable data to 1 id and model_id.