2016-11-29 1 views

Répondre

-1

supprimer top (select count (a.Policy) -1 De x où Table1 x.policy dans (Sélectionner politique distincte de table2)) de table1

+0

Veuillez formater votre code et décrivez votre réponse en quelques lignes, merci, Pour formater en tant que code développez votre code avec 4 espaces à gauche – hmmftg

0
delete from table1 f0 
where rrn(f0) in 
(
    select f3.rw from (
        select rrn(f1) rw, 
        rownumber() over(partition by Policy) rang 
        from table1 f1 inner join table2 f2 on f1.policy=f2.policy 
        ) f3 
    where f3.rang=1 
)