#查重:
Select * From 表名 Where 字段名称 In (Select 字段名称 From 表名 Group By 字段名称 Having Count(*)>1)
#删除重复数据只留其中一条
DELETE FROM 表名 where id not in (select id from (select min(id) as id from 表名 group by 字段名称) as b ) ;
select *
FROM
tpaas_corp2
WHERE
corp_name IN (
SELECT
t.corp_name
FROM
(
SELECT
corp_name
FROM
tpaas_corp2
GROUP BY
corp_name
HAVING
count(1) > 1
) t
)
AND id NOT IN (
SELECT
dt.minid
FROM
(
SELECT
min(id) AS minid
FROM
tpaas_corp
GROUP BY
corp_name
HAVING
count(1) > 1
) dt
)