有表t,字段a、b、c
要取记录distinct a, min(b), max(c)
要取记录distinct a, min(b), max(c)
解决方案 »
- 求一存储过程 请大侠帮忙!!!!!
- select时间查询问题, 非常着急啊,5555
- 这是怎么回事?
- 在oracle的存储过程中用事务如何实现.net中的try/catch语句?如何写啊?
- 自动增长列编号回零问题
- 请教一个简单的问题可以吗?
- imp问题
- 为什么我用jsp调用oracle8i时,无法用beforeFirst(),高手帮帮忙!
- sql server 和ORACLE的不兼容问题(新)
- 在Windows2000中的Oracle 8.1.6中,我执行一个备份作业时出错,出错信息为"VNI-2015:验证错误";
- 急急急(50分)oracle 存储过程中,如何分割字符串 例如:
- 在Unix下编译Pro*C源程序,为什么总提示找不到Make.defines文件?
select distinct a, min(b), max(c) from t
select distinct a, b, c
from t
where b in (select b from t where b in (select min(b) from t))
or c in (select c from t where c in (select max(c) from t))
from t
where b = (select min(b) from t t1 where t1.a = t.a)
and c = (select max(c) from t t2 where t.a = t2.a and t.b = t2.b)
不知道这种方法是否正确,请高手指正。
001
012
100
101
112
我想取的是:
001
101
而非
002
102你不是说要max(c)吗? max(c)就是2阿
1 select a,b,max(c) from(
2 select a.a,b.b,a.c from test a,(select min(b) b from test) b where a.b=b.b)
3* group by a,b
SQL> / A B MAX(C)
---------- ---------- ----------
0 0 1
1 0 1