日期:2014-05-18 浏览次数:20720 次
create table temp_T1 ( ID int, U1 varchar(100), U2 varchar(100) ) insert into temp_T1 select 1,'AA2,BB3,AA,AA4','' insert into temp_T1 select 2,'DD1,DD2','' insert into temp_T1 select 3,'CC1','' insert into temp_T1 select 4,'EE8,AA','' insert into temp_T1 select 5,'XX','' insert into temp_T1 select 6,'','TT' insert into temp_T1 select 7,'CCCC','' insert into temp_T1 select 8,'','AA' insert into temp_T1 select 9,'BXXX','' select * from temp_T1 ID U1 U2 ----------- ---------------------------------------------------------------- ---------------------------------------------------------------- 1 AA2,BB3,AA,AA4 2 DD1,DD2 3 CC1 4 EE8,AA 5 XX 6 TT 7 CCCC 8 AA 9 BXXX (9 行受影响)
--漏写分隔符 select * from tb where ','+u1+',' like '%,AA,%' or ','+u2+',' not like '%,AA,%'