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

  e1.emp_name=e2.emp_name and e1.salary=e2.salary);

 

    EMP_ID EMP_NAME                                     SALARY

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

         1 sunshine                                      10000

         3 xyz                                             30000

         2 semon                                         20000

 

 

2. 删除的几种方法:

 

1)通过建立临时表来实现

SQL>create table temp_emp as (select distinct * from employee) 

SQL> truncate table employee; (清空employee表的数据)

SQL> insert into employee select * from temp_emp;

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


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