例如数据库中有如下记录
A 1
A 2
A 3
B 1
B 2
C 1
C 3
我想查询只包含1或者1和3的记录,请问怎么写呢
A 1
A 2
A 3
B 1
B 2
C 1
C 3
我想查询只包含1或者1和3的记录,请问怎么写呢
解决方案 »
- select的问题
- 急!Oracle 10g安装问题,HP UNIX11.31,苏州有谁可上门装
- JDBC连接池偶尔"Io 异常: The Network Adapter could not establish the connection"
- 关于oracle全文检索,对xml如何检索带2个属性的标签行?
- 怎么修改oracle9i里的默认时间格式?
- 一条select 查询速度问题?急!!
- 请教一个简单的触发器的问题
- 请求支援!关于网络资源的问题。
- 各为高手,请问Recovery Manager (RMAN)如何使用
- 世界这么大,行业这么多,我想转行看看,求助
- 为什么游标循环的时候结果会被覆盖
- SQL语句请教
如果是的话。select * from tablename t where t.数字=1 and t.数字=3
假设 你的2个字段的名字分别是A 与 B
select * from table where B=1 or B=3
select * from tablename t where t.数字 in(1,3) 1和3
(select col1,wm_concat(col2) col2
from tb1
group by col2)
where col2 in ('1','1,3')
嗯 貌似有可能 那改成where col2 in ('1','1,3','3,1')应该可以了
select 'a' a,1 b from dual
union
select 'a',2 from dual
union
select 'a',3 from dual
union
select 'b',1 from dual
union
select 'b',2 from dual
union
select 'c',1 from dual
union
select 'c',3 from dual
)
select * from t2 t where (t.b=1 or t.b in(1,3));