【取最后路径的问题】
表TB的PATH字段如下
path-------------11-21-2-31-2-3-4aa-ba-b-ca-b-da-e我要的结果/*path-------------1-2-3-4a-ea-b-ca-b-d*/
--> 测试数据:@tbdeclare @tb table([path] varchar(7))insert @tbselect '1' union allselect '1-2' union allselect '1-2-3' union allselect '1-2-3-4' union allselect 'a' union allselect 'a-b' union allselect 'a-b-c' union allselect 'a-b-d' union allselect 'a-e'select * from @tb AS AWHERE NOT EXISTS(SELECT * FROM @tb WHERE path LIKE A.path + '_%')