送分贴 一个表中有三个字段。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 ORACLE 整形和小数 sql优化 查询时的格式,影响了结果 用存储过程实现树状结构的展示 开始学习,求教 怎么让instr函数,不区分大小写?默认是区分大小写的 求一查询语句 菜鸟问题 如何察看未释放的连接 (在线等!) jsp 访问 oracle 数据库问题 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;