sql 子级拼接父级

select A.*,case when (select count(*) from tb_jc_xz B where A.parentid = B.uid) >0 
then cast((select B.mc from tb_jc_xz B wh

ere A.parentid = B.uid) as VARCHAR)+'-'+A.mc  else A.mc end as id from tb_jc_xz A

发布了180 篇原创文章 · 获赞 27 · 访问量 15万+

猜你喜欢

转载自blog.csdn.net/sinat_28238111/article/details/104253316