Si es 2008, puedes hacer uso de CTE para eliminar los duplicados, te pongo un ejemplo
Código SQL:
Ver originalWITH Dublicates_CTE(Username, accountid)
AS
(
SELECT UserName,MIN(accountid)
FROM Accounts
GROUP BY username
HAVING COUNT(*) > 1
)
DELETE FROM Accounts
WHERE accountid IN (
SELECT Accounts.accountid
FROM Accounts
INNER JOIN Dublicates_CTE
ON Accounts.Username = Dublicates_CTE.Username
AND Accounts.accountid <> Dublicates_CTE.accountid