1 - If the both tables have any thing that is related then you can use one table PK to get the other table’s data that is related with it using Relations in your model.
2 - If Currently both the tables are not related to each other, then you must have to set an algorithm that will manipulate to bring the required data out from DB.
For the first case, in your model of each of the table, when you define the relation, you can access the data by using the with property of the model and can use it as
Thank you PeRoChAk, in my case both table are not related to each other.
Could you straight to the example, since I’m not really understand what you mean by set an algorithm. I do understand PHP and MySQL syntax. If I do it with pure PHP, not Yii, I will do something like this :
$sql = "select * from table A where id='something'"
While {
$id = row->id
$name = row->name
$salary = row->basic_salary
"select allowance from table B where id=$id"
while {
$allowance = row->allowance
$addvalues = $salary+$allowance
echo "$id - $name - $basic_salary ";
echo " - $allowance";
echo "----------------------------";
echo " total = $addvalues";
} //end 2nd while
} // end 1st while