删除重复数据,保留一条ID最小的
SELECT * from TBCITY_Temp
where code
in (
select
code
from TBCITY_Temp
group by code
having count(code) > 1
)
and AutoId not in (
select min(AutoId)
from TBCITY_Temp
group by code
having count(code)>1)
-- 条件为code再重复数据里,and Id 不是最小的