Delete MatchImage
where DataId in
(select DataId FROM MatchImage group By DataId having Count(Id)>1) and Id not in (select min(Id) from MatchImage group by DataId having count(*)>1)
Delete MatchImage
where DataId in
(select DataId FROM MatchImage group By DataId having Count(Id)>1) and Id not in (select min(Id) from MatchImage group by DataId having count(*)>1)