asp)这种语句该如何写??
-
jw1b
2008-08-22 12:43
数据库是sql2000的,产品表product里面有个字段value(nvarchar类型),里面储存有数据如(1,2,3,4)。我想用户点击网页的时候筛选出相应内容,如用户在网页上点击1的时候。查询产品product表value字段里面包含1的产品
语句为:
select * from product where value in ('1')
.为什么查询不出来??
Re:asp)这种语句该如何写??
-
dreamcoco
2008-08-22 13:19
select * from product where value=1不行吗?干嘛要用in?
Re:asp)这种语句该如何写??
-
土改工作组
2008-08-22 14:19
select * from product where value in ('1') == select * from product where value='1'
value in 在这里是等式
换成 select * from product where value like '%1,%'
Re:asp)这种语句该如何写??
-
asu530
2008-08-23 13:22
先取出数据,再分割查询,用like如果有ID 1 和11 这样的就有问题了。
Re:asp)这种语句该如何写??
-
aboys
2008-08-25 11:15
in不是这么用的,
你这个问题是比较繁琐的,用模糊查询是个比较好的注意。
Re:asp)这种语句该如何写??
-
杭州天堂
2008-09-11 01:28
select * from product where CharIndex( '1,',value) > 0
Re:asp)这种语句该如何写??
-
flyingsoul
2008-09-11 11:43
我觉得还是用like 好些 把要查询的字段在前面加上
Re:asp)这种语句该如何写??
-
wxj_16740
2008-09-13 17:29
这样写肯定错了