当前位置: 移动技术网 > IT编程>数据库>Oracle > Oracle重复行查询实例教程

Oracle重复行查询实例教程

2018年09月30日  | 移动技术网IT编程  | 我要评论

陆滢胸围,步步高广告曲,cz3523航班

oracle重复行查询实例教程

create table dlp_test (a number(2),b number(2));

 insert into dlp_test values(1,2);
 insert into dlp_test values(1,2);
 insert into dlp_test values(3,4);
 insert into dlp_test values(5,6);
 insert into dlp_test values(3,5); 
 insert into dlp_test values(3,5);
select * from  dlp_test ;

\

--获取不重复行
select distinct x.* from dlp_test x;

--获取仅出现一次的行
--①
select a.*
  from dlp_test a,
       (select a, b from dlp_test group by a, b having count(*) = 1) b
 where a.a = b.a
   and a.b = b.b;
--②
select *
  from dlp_test
 where rowid in (select rowid
                   from (select a, b, count(*) over(partition by a, b) t
                           from dlp_test)
                  where t = 1);

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网