日期:2014-05-17 浏览次数:20558 次
select * from tb where '09100101' like 节点+'%'-- and 节点<>'09100101'
--> 测试数据:[TB]
if object_id('[TB]') is not null drop table [TB]
GO
create table [TB]([col] varchar(8))
insert [TB]
select '09' union all
select '091' union all
select '09100' union all
select '091001' union all
select '09100101'
SELECT distinct b.col from [TB] a
INNER JOIN TB b ON CHARINDEX(a.col,b.COl)=1 AND a.col<>b.col
/*
col
--------
091
09100
091001
09100101
(4 行受影响)
*/
drop table [TB]