1、创建测试表,
create table test_dis(id number, name varchar2(20), value number(10))
2、插入测试数据
insert into test_dis values(1,'a',123)
insert into test_dis values(2,'b',152)
insert into test_dis values(3,'c',123)
insert into test_dis values(4,'d',520)
insert into test_dis values(5,'e',300)
commit
3、查询表中全量数据,select t.*, rowid from test_dis t
4、编写sql,查询表中某一字段不重复的所有数据,可以发现只有id为2,4,5的记录查询出。
select * from test_dis t where value in (select value from test_dis group by value having count(*)=1)
select t.* from 表 twhere exists(select * from 表 a where a.第二列 = t.第二列 group by a.第二列 having count(a.第二列) = 1)
你测测吧,给个采纳就行了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)