Mit einem LEFT JOIN
:
select t1.name Country, count(distinct t2.name) Count
from country t1 left join cities t2
on t2.name like concat('%, ', t1.name)
group by t1.name
Sehen Sie sich die Demo
an .
Ergebnisse:
| Country | Count |
| ------- | ----- |
| France | 2 |
| Italy | 1 |
| USA | 2 |