【发布时间】:2012-08-31 07:24:46
【问题描述】:
我有以下 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 作为外键
任何想法,相同的查询是什么?
谢谢!!
【问题讨论】:
标签: php statistics dashboard