次のmysqlデータベーステーブルがあります:
cities
states
countries
と
members
samajs(国際的な人々のグループ)
dashboardそして、次の結果が得られる自分のページのクエリを作成したいと思います。
Country Members Samajs Total (table header)
Country1 7 5 16 (country row with total members, samajs and total count)
state1 5 2 7 (state row with total members, samajs and total count)
city1 3 1 4 (all cities in that state, city row with total members, samajs and total count)
city2 2 0 2
state2 2 1 3
Country2 3 2 5 (country row with total members, samajs and total count)
...and vice versa....
ここで、membersテーブルはcountry_id, state_id and city_id外部キーとして持ちます
samajsテーブルも country_id, state_id and city_id外部キーとして持つ
任意のアイデア、同じクエリは何ですか?
ありがとう !!