论坛首页 综合技术论坛

Oracle数据去重复数据

浏览 4569 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (3) :: 隐藏帖 (1)
作者 正文
   发表时间:2011-10-21  
1 59 111 西城区长安街176号) 1 文化广  /images/merchant/wenhua.jpg 39 0

2 59 56 西城区长安街176号) 1 广场 /images/merchant/wenhua.jpg 39 0

3 59 114 西城区长安街176号) 1 广场 /images/merchant/wenhua.jpg 39 0

4 59 103 西城区长安街176号) 1 化广场 /images/merchant/wenhua.jpg 39 0


结果:

1 59 111 西城区长安街176号) 1 文化广  /images/merchant/wenhua.jpg 39 0

根据第二列59和第八列39 去除重复记录。
   发表时间:2011-10-24  
oracle:
delete  tab t where t.rowid > (
    select min(t2.rowid) from tab t2 where t.col2 = t2.col2 and t.col8 = t2.col8
)
0 请登录后投票
   发表时间:2011-11-09  
查询的时候么
distinct

如果是删除 应该楼上的可以,没仔细看
0 请登录后投票
   发表时间:2011-11-09  
用分析函数 row_number() partion by 那几个一样的字段,在最外层套一个select取第一行
0 请登录后投票
   发表时间:2011-11-10  

delete from (select rank() over partition by (col1,col2) num from t1)
where num > 1
0 请登录后投票
   发表时间:2011-11-14  
select * from table where id in(select min(id) from table group by column2,column8)
1 请登录后投票
   发表时间:2011-11-14  
知道  哪种效率最好咯
0 请登录后投票
   发表时间:2011-11-14  
select * from emp e where e.rowid =(select min(tmp.rowid) from emp tmp where tmp.job=e.job and tmp.deptno=e.deptno);
0 请登录后投票
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics