+ -
当前位置:首页 → 问答吧 → 请教 为何查询不到数据?

请教 为何查询不到数据?

时间:2011-12-13

来源:互联网


tableA
30
40
41
30,40,41


select * from tableA
where 1 = 1
and id in (30)


为什么只查处第一条数据呢?第四条数据没出来?

作者: chkmouse   发布时间: 2011-12-13

都in了 肯定查不出来喽

作者: hllfl   发布时间: 2011-12-13

try this,
SQL code

select * from tableA
where 1 = 1
and id like '%30%'

作者: ap0405140   发布时间: 2011-12-13

select * from tableA
where 1 = 1
and id like '30%'

作者: Leftie   发布时间: 2011-12-13

SQL code

select * from tableA
where 1 = 1
   and ',30,' like ','+ltrim(id)+','

作者: AcHerat   发布时间: 2011-12-13

in不是用来进行模糊查询的~

作者: sjcss   发布时间: 2011-12-13