create table T(book_name nvarchar(10), book_ztid varchar(20))
insert T select '书名A', '4'
union all select '书名B', '2,4,5'
union all select '书名C', '3,5,14,24,25,34'
union all select '书名D', '4,24'
select * from T
where charindex(',4,', ','+book_ztid+',')>0
--result
book_name book_ztid
---------- --------------------
书名A 4
书名B 2,4,5
书名D 4,24
(3 row(s) affected) |