这个该怎么查询呢.

chi742658817 2016-11-04 10:32:00


表A

id a b c d
1 ts01 001 10 ss
2 ts01 001 20 cs
3 ts01 001 30 os
4 ts01 001 10 ss
5 ts02 001 10 ss
6 ts02 001 20 cs
7 ts02 001 30 os
.............................................................................(还有许多)
我想查询出abcd列的值都相同的所有行,比如第一行和第四行,

该怎么查,数据有很多,有没有速度快点的.
...全文
119 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
chi742658817 2016-11-04
  • 打赏
  • 举报
回复
引用 3 楼 wmxcn2000 的回复:
两个办法你自己平衡一下用哪个 1、select id,name from t group by id,name having count(*) > 1 2、with a as (select *, count(*) over(partition by id,name) rs from t ) select * from a where rs > 1
谢谢大佬
卖水果的net 2016-11-04
  • 打赏
  • 举报
回复
两个办法你自己平衡一下用哪个 1、select id,name from t group by id,name having count(*) > 1 2、with a as (select *, count(*) over(partition by id,name) rs from t ) select * from a where rs > 1
chi742658817 2016-11-04
  • 打赏
  • 举报
回复
引用 1 楼 wmxcn2000 的回复:
用 distinct 速度不行吗?
我不是要去重复,是想把它查询出来.像上面的表一样,把重复的第一行和第四行查出来,有啥办法不.
卖水果的net 2016-11-04
  • 打赏
  • 举报
回复
用 distinct 速度不行吗?
qq_36611253 2016-11-04
  • 打赏
  • 举报
回复
select * from tablename where(a,b,c,d)in(select a,b,c,d from mpplli group by a,b,c,d having count(*)>1)

17,134

社区成员

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

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