110,535
社区成员
发帖
与我相关
我的任务
分享
;with cc as(
SELECT row_number() over(PARTITION by diqu order by diqu) as rowid,* from #ab)
select cc.diqu,
name1= max(case when cc.rowid = 1 then cc.name end), --and cc.oder = 1 then cc.times else cc.times end),
name2= max(case when cc.rowid = 2 then cc.name when cc.rowid <>2 then '' end)
from cc group by cc.diqu
delete from #ab where diqu='父节点' and name ='当前节点名'