sql语句,根据地区ID编号取对应的地区名称 30
2个回答
展开全部
select shname,shiname,name from table
inner join
(
(
select name as shname , left(code,2) as shcode from table
where right(code,4) = '0000'
)
inner join
(
select name as shiname , left(code,2) as shicode from table
where right(code,2) = '00'
and right(code,4) <> '0000'
)
on shcode = shicode
)
on left(code,2) = shcode
inner join
(
(
select name as shname , left(code,2) as shcode from table
where right(code,4) = '0000'
)
inner join
(
select name as shiname , left(code,2) as shicode from table
where right(code,2) = '00'
and right(code,4) <> '0000'
)
on shcode = shicode
)
on left(code,2) = shcode
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询