A表
province_id
city_id
county_id
B表
AreaID
AreaName
AreaType
A表中的3个字段全部关联B表的AreaID字段
B表中AreaType=1代表省,2代表市,3代表区县
请教下怎样查出A表我想要的一条结果,也就是地区显示中文AreaName,而不是AreaID
select case B.AreaType when 1 then xxx when 2 then xxx when 3 xxx end as AreaName, B.xx,A.* from A inner join B on a.province_id=a.AreaID,a.city_id=a.AreaID,a.country_id=a.AreaID
select b.AreaName from a,b where a.province_id=AreaID or county_id=AreaID or city_id=AreaID
select B.AreaName from A,B where B.AreaID=A.province_id and B.AreaID=A.city_id and B.AreaID=A.county_id
select B.AreaName from a,B where B.AreaID=A.province_id and B.AreaID=A.city_id and B.AreaID=A.county_id
select case B.AreaType when 1 then xxx when 2 then xxx when 3 xxx end as AreaName, B.xx,A.* from A inner join B on a.province_id=a.AreaID,a.city_id=a.AreaID,a.country_id=a.AreaID
实话说,你的需求我没太看明白,不过这个思路应该是符合你的题目要求的