How to pull data out of mysql?

Our goal is to make a list of the branches. At the moment, the conclusion need only two countries, but better to do it on an infinite number.
It is 2: query
SELECT * FROM filialy WHERE fed_okr_id IN(8) AND activity = 1 ORDER BY city
SELECT * FROM filialy WHERE fed_okr_id IN(1,2,3,4,5,6,7,9) AND NOT id = 29 AND activity = 1 ORDER BY city

Such a conclusion
<div class="mb-1">
Russia:
 <?php 
 while ($row = mysqli_fetch_array($dealers_russia)) { ?>
 <a href="/filialy/<?=$row['link_filial']?>"><span class="badge badge-primary"><?=$row['city']?></span></a>
<?php
}
?>
</div>
 <div class="mb-1">
Kazakhstan:
 <?php 
 while ($row = mysqli_fetch_array($dealers_kz)) { ?>
 <a href="/filialy/<?=$row['link_filial']?>"><span class="badge badge-primary"><?=$row['city']?></span></a>
<?php
}
?>
 </div>


I changed the table structure and added binding field, changed the request to
SELECT filialy.city filialy.link_filial city.name_city city.countyId 
 FROM filialy 
 INNER JOIN city ON filialy.cityId = city.id_city
 WHERE filialy.activity = 1 
 ORDER BY filialy.city

But there was a problem with the conclusion. how to properly display all the branches pertaining to a specific country, not the fruit additional queries and loops?
April 19th 20 at 12:03
0 answer

Find more questions by tags MySQLPHP