送分贴

l8487 2008-11-04 07:38:10
一个表中有三个字段。A,B,C。。查询A不同,B、C相同的数据
...全文
86 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
icss_zhen 2008-11-04
  • 打赏
  • 举报
回复
送分贴是不是只要答了就有分哦!不过分好少,看来是没戏了。哈哈
yefengyuhongwei 2008-11-04
  • 打赏
  • 举报
回复
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
hebo2005 2008-11-04
  • 打赏
  • 举报
回复
贴你想要的结果,这样看的比较清楚
BlueskyWide 2008-11-04
  • 打赏
  • 举报
回复
--少写了表名:

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;
范佩西_11 2008-11-04
  • 打赏
  • 举报
回复
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;
BlueskyWide 2008-11-04
  • 打赏
  • 举报
回复
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;
BlueskyWide 2008-11-04
  • 打赏
  • 举报
回复
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;



[Quote=引用 3 楼 l8487 的回复:]
不好意思啊。我没有说明白。。我的意思是,比如有两条这样的数据
A B C
1 1 3
2 1 3
3 1 2
现在要查出前两条。。。
[/Quote]
aaajj 2008-11-04
  • 打赏
  • 举报
回复
select * from v_table where a <> b and b = c;
l8487 2008-11-04
  • 打赏
  • 举报
回复
oracle有专门函数没有。。2楼的效率怎么样。
l8487 2008-11-04
  • 打赏
  • 举报
回复
不好意思啊。我没有说明白。。我的意思是,比如有两条这样的数据
A B C
1 1 3
2 1 3
3 1 2
现在要查出前两条。。。
范佩西_11 2008-11-04
  • 打赏
  • 举报
回复
select a.* from tableA a,tableA b where a.b=b.b and a.c=b.c  and a.a<>b.a
BlueskyWide 2008-11-04
  • 打赏
  • 举报
回复
select * from tableA where b=c and a<>b;



[Quote=引用楼主 l8487 的帖子:]
一个表中有三个字段。A,B,C。。查询A不同,B、C相同的数据
[/Quote]

17,089

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧