找出含有某个字符的最大id,该怎么解决

找出含有某个字符的最大id数据库中有字段idpathcode1null2/13/1/24/1/25/1/26/1/2/47/1/2/48/1/2/4/5找出

找出含有某个字符的最大id
数据库中有字段
id pathcode
1 null
2 /1
3 /1/2
4 /1/2
5 /1/2
6 /1/2/4
7 /1/2/4
8 /1/2/4/5

找出数据库中含有2个 "/" 最大id,此数据中最大id=5 ,请问Sql语句怎么写?

[解决办法]

SQL code
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 行受影响)