日期:2014-05-18 浏览次数:20531 次
create table tb (id int, pathcode varchar(50) ) insert into tb values(1,'') insert into tb values(2,'/1') insert into tb values(3,'/1/2') insert into tb values(4,'/1/2') insert into tb values(5,'/1/2') insert into tb values(6,'/1/2/4') insert into tb values(7,'7 /1/2/4') insert into tb values(8,'/1/2/4/5') select max(id) from tb where len(pathcode) - len(replace(pathcode,'/','')) =2 ----------- 5 (1 行受影响)