34,587
社区成员
发帖
与我相关
我的任务
分享
select * from tb a where not exists(select 1 from tb where a.code=left(code,len(a.code)) and and code<>a.code)
and code<>a.code)
[Quote=引用 8 楼 anbin0814 的回复:]
select *
from tb a
where not exists (select 1 from tb where a.code=left(code,len(a.code)) and len(code)>len(a.code))
select * from tb
where not exists (select 1 from tb where a.code=left(code,len(a.code))
and code<>a.code)
select case when exists(select 1 from tb where a.code=left(code,len(a.code))
and code<>a.code) then '存在' else '不存在' end
from tb a
select case exists(select 1 from tb where a.code=left(code,len(a.code))
and code<>a.code) then '存在' else '不存在' end
from tb a
select case exists(select 1 from tb where a.code=left(code,len(code))
and code<>a.code) then '存在' else '不存在' end
from tb a
select * from tb where substring(code,5,2)<>''