这样的查询语句如何写?
com1字段为char类型
当查询com1为'01','02','03','04'时可以这样写:
select * from table where com1 in ('01','02','03','04')
但是当查询com1为'01','02','03',。。。。'40'时就不能用上面的方法,
运行会提示:sql语句太长了
大侠们请问我该如何写查询语句 谢谢
问题点数:50、回复次数:4Top
1 楼zfive5(醉马不肖)回复于 2004-05-02 20:53:27 得分 25
select * from table where in (select cc from test1)
test1
cc
01
02
03
04
...
50Top
2 楼caizicheng(觉&悟)回复于 2004-05-02 21:17:40 得分 0
还有其他方法吗?Top
3 楼dfsdf36(dfsdf36)回复于 2004-05-02 21:23:39 得分 25
select * from table where substr(coml,1,1) between ('0','4')
and substr(coml,2,1) between ('0','9')
and coml like '??'Top
4 楼caizicheng(觉&悟)回复于 2004-05-02 21:35:16 得分 0
我试试看Top




