获取数据
进入高德地图的官网,下载到我们需要的数据:高德地图官网
修改成cxv文件导入到mysql
根据id更新生成pid
修改省pid
update area set pid = 0 where SUBSTRING(id, -4) = 0000
修改市pid
update area set pid = CONCAT(SUBSTRING(id,1,2),'0000') where SUBSTRING(id, -2) = 00 and SUBSTRING(id, -4) != 0000
修改区pid
update area set pid = CONCAT(SUBSTRING(id,1,4),'00') where SUBSTRING(id, -2) != 00
查询市辖区
select * from area where SUBSTRING(name, -3) = '市辖区'
修改市辖区
update area set name = '市辖区' where SUBSTRING(name, -3) = '市辖区'