id对应一个vachar字段的查询 select id,title from table where id in()?其中括号里为用逗号隔开的多个数字的vachar类型,格式为12,23,25,34,54,请教怎么能得到这几个数值对应的结果? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 where charindex(',12,23,25,34,54,',','+ltrim(id)+',')>0 select id,title from table where id in ('12','23','25','34','54') select id,title from table where id in ('12','23','25','34','54') order by id select id,title from table where charindex(',12,23,25,34,54,',','+ltrim(id)+',')>0 谢谢各位了,我还是用的in,开始测试的时候,有个地方没通过,还认为int的id不能用in呢。回来测试一下还是可以的。 int类型的也是可以的where id int(1,2,3,4,5,7,8) where id in (1,2,3,4,5,7,8) --应该是这样 --用charindex函数做where条件select id,title from table where charindex(','+id+',',',12,23,25,34,54,')>0 有条件删除数据很慢的问题? SQL server 2005的 try catch 在 SQL server 2000的实现 一条SQL语句不知怎么写,大家一起来讨论一下。我写了老不对。 where 语句中的字段值如何区分大小写 数据库脚本转换导出 sqlserver.exe 占用大量CPU 动态sql语句超过8000个字符的处理方法 关于显示数据库中所有表名的问题? 请问如何用一个sql语句实现从两张表里面读数据??????????? 有关SQLSERVER的连接问题!请教各位高手!!!! 请教提取数据,在线等 帮忙看看sql怎么改
where id int(1,2,3,4,5,7,8)
--用charindex函数做where条件
select id,title from table where charindex(','+id+',',',12,23,25,34,54,')>0