查询表中重复的第一条数据
重复的:
select column1,column2 from table
group by column1,column2
having(count(*))>1
第一条
select top 1 * from table where column in(select column1,column2 from table
group by column1,column2
having(count(*))>1 )
having的用法
SELECT 字段表
FROM 表
WHERE选择准则
GROUP BY 分组字段表
[HAVING分组准则]
删除重复记录
select distinct * into #Tmp from a
drop table a
select * into a from #Tmp
drop table #Tmp