比较重复搜索中找到的结果后,TSQL 删除 table 中的重复项

TSQL Delete Duplicates in table after comparing results found in duplicate search

我在单个 table 中有重复数据。

Table布局

 accountNumber | firstName | lastName | address | zip 
 SMI2365894511 | Paul      | Smith    | 1245 Rd | 89120
 SMI2365894511 | Paul      | Smith    |         |

我有以下查询来查找和显示重复项。

select *
  from tableA a
  join (select accountNumber
          from tableA 
          group by accountNumber
         having count(*) > 1 ) b
    on a.accountNumber = b.accountNumber

我想做的是比较上述查询的结果并删除没有任何地址信息的重复项。我正在使用 MS SQL Server 2014

编辑** 我按照原样进行查询,因此可以看到两个重复的行

delete a 
  from XmaCustomerDetails a
  join ( select accountNumber
           from XmaCustomerDetails 
          group by accountNumber
         having count(*) > 1 ) b
    on a.accountNumber = b.accountNumber
WHERE address is null