table
ID A(string)
1 252
2 52,53,54
3 52,53,54
4 52,53,54
5 52,53,54,55
select count(*) from table where a like '%'+convert(nvarchar(50),table.a)+'%'
这样的话,肯定不对。 52 会统计为 5个。
------解决思路----------------------
不知道你的sql中a 是什么意思
declare @i int
set @i=52
select count(*) from tablename where ','+convert(varchar(50),@i)+',' like '%,'+A+',%'
------解决思路----------------------
如果你是要统计A里面有多少个数的话用这个
select ID,len(a)-len(REPLACE(a,',',''))+1 from tablename