delete RemoteDetection WHERE REMOTEDETECTIONID IN (
select ID from (
select MIN(REMOTEDETECTIONID) ID,r.VLPN,r.PASSDATETIME from RemoteDetection r inner join (
select VLPN,PASSDATETIME,COUNT(1) as num from RemoteDetection where 1=1 group by VLPN,PASSDATETIME Having COUNT(1)>1
) a on r.VLPN=a.VLPN and a.PASSDATETIME=r.PASSDATETIME
group by r.VLPN,r.PASSDATETIME
) t
)

05-14 08:38