您的位置:积木首页 >> 数据库频道 >> MS_SQL >> 正文:
标题:在SQL中删除重复记录(多种方法)
时间:2005-8-23 来源:不详 浏览数:
=e2.salary);

 

3)也是通过rowid,但效率更高。

SQL>delete from employee where rowid not in (
       
select max(t1.rowid) from employee t1 group by

         t1.emp_id,t1.emp_name,t1.salary);--这里用min(rowid)也可以。

 

    EMP_ID EMP_NAME                                     SALARY

---------- ---------------------------------------- ----------

         1 sunshine                                      10000

         3 xyz                                             30000

         2 semon                                         20000

 

 

 

SQL> desc employee

 Name                                      Null?    Type
 ----------------------------------------- -------- ------------------

emp_id                                                NUMBER(10)
emp_name                 &n

上一页  [1] [2] [3] [4] [5] [6] [7] [8] 下一页


(责任编辑:欣欣裴)
最近更新
今日推荐
热点文章