一、问题描述
环结点表如下:
预期结果:1->3,3->4,4->1.
二、解决方案
declare @minVertex int Select @minVertex= min(Vertex) from CircLevertex select vertex as parentVertex,isnull((select top 1 vertex from circLevertex R where R.id > T.id order by R.id ),@minVertex) as childVertex from circLevertex T
三、参考
[1].SQL Server combining 2 rows into 1 from the same table
[2].How to combine 2 rows into 1 from the same table
期待您更好的解决方案!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。