输入banner图图片脚本导航/分类

SQL Server删除重复行的6个方法

group   by   col1,col2,col3,col4       

)    

group   by   子句后跟的字段就是你用来判断重复的条件,如只有col1,那么只要col1字段内容相同即表示记录相同。  

6. 

select   identity(int,1,1)   as   id,*   into   #temp   from   tabel     

select   *   from     #temp   where   id   in   (     

select   max(id)   from   #emp   where   having   count(*)>1   group   by   col1,col2,col3...)    

SQL Server删除重复行的6个方法

标签: