How to display records?

There are two dB tables. I want to output the cycle of the records from one table, but each entry should show the related records from the second table.
For example:
Russia 1000 people
-Moscow 500 people
Peter 500 people.
And so, other countries

The first table connects the related records from the second table considers the sum of a particular column from the second table
June 14th 19 at 18:07
2 answers
June 14th 19 at 18:09
June 14th 19 at 18:11
withJoin()

Find more questions by tags Yii