select * from table1 b where bill_id=(select top 1 bill_id from table1 a where exists(select top 1 column1 from table1 where column1=lumn1 group by column1 having count(*)>1 order by column1) and lumn1=lumn1) order by column1SQL语句查询有部份字段重复的第一条数据
你的图中post_content全一样,post_title有两种,这算不算重复呀?我按post_content重复就查找出来。查重:select post_content,post_title from wp_posts group by post_content having count(post_content)>1删除要先将数据查询到临时表中,然后将原表清空,在追加回来。
使用临时表求出重复记录select userid from t_name group by userid having count(*) > 1求出不重复记录select distinct * into #a1 from t_name where userid in select userid from t_name group by userid having count(*) > 1删除重复记录从#a1取出不重复记录