我有这个SQL查询来选择所有没有订单的重复客户:
{{1}}
如何更改此查询以删除这些客户?
感谢您的帮助
答案 0 :(得分:0)
delete from [KUNDEN]
where nummer in (
select distinct nummer
from [KUNDEN] k1
where not exists (
select * from [BELEG] b
where k1.Nummer = b.Adressnummer)
and exists (
select * from [KUNDEN] k2
where k1.Nummer <> k2.Nummer
and k1.Name = k2.Name
and k1.Vorname = k2.Vorname)
)