送分贴 一个表中有三个字段。A,B,C。。查询A不同,B、C相同的数据 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from tableA where b=c and a<>b; select a.* from tableA a,tableA b where a.b=b.b and a.c=b.c and a.a<>b.a 不好意思啊。我没有说明白。。我的意思是,比如有两条这样的数据A B C1 1 32 1 33 1 2现在要查出前两条 oracle有专门函数没有。。2楼的效率怎么样。 select * from v_table where a <> b and b = c; select t.a,t.b,t.c from (select a,b,c,rownum rn from Table_test order by a) t where t.rn<=2; select t.a,t.b,t.c from (select a, b, c, count(rownum) rn over (partition by b,c group by b,c)) t where t.rn>1; select a, b, c from (select a, b, c, row_number() over(partition by b, c order by rowid) rn from tablename) where rn > 1; --少写了表名:select t.a,t.b,t.c from (select a, b, c, count(rownum) rn over (partition by b,c group by b,c) from table_test) t where t.rn>1; select a.A,a.B,a.C from tables a,tables b where a.B=b.B and a.C=b.C and a.A<>b.A Listener.ora、TNSNAMES.ora客户端和服务端的对应关系是什么? dense_rank 一个分组中的值都是相同的,如何取第一条? 怎么在C# 程序中执行Wrap 过的Oracle 存储过程阿? 统计报表问题 问下怎么查看事务提交或回滚时的SCN号?? 关于in操作符的问题 linux下oracle9i创建数据库时出现的问题?? 关于ROWID的使用??? 我的oracle为什么安装不了 system为什么只有在本机才可以连接? SQL优化 trigger的问题
A B C
1 1 3
2 1 3
3 1 2
现在要查出前两条
(select a,
b,
c,
count(rownum) rn over (partition by b,c group by b,c)) t
where t.rn>1;
from (select a,
b,
c,
row_number() over(partition by b, c order by rowid) rn
from tablename)
where rn > 1;
(select a,
b,
c,
count(rownum) rn over (partition by b,c group by b,c)
from table_test) t
where t.rn>1;