如何在单个 mysql 命令中删除此选择查询的结果?

How I can delete the result of this selection query in a single mysql command?

Table name radacct radacctid 是 pk accountuniqueid 是订阅者在连接时生成的几乎唯一的字符串。

这是 mysql 查询,它输出重复的条目我想在同一命令中删除结果以自动执行此过程。

select *
from radacct
group by acctuniqueid
HAVING
(radacct.acctuniqueid > 1)

我假设您在 HAVING 子句中指的是 HAVING COUNT(acctuniqueid) > 1。如果你真的想删除所有重复项(即保留 NONE 个重复项):

DELETE FROM
    radacct
WHERE
    `acctuniqueid` IN (
        SELECT `acctuniqueid` FROM (
            SELECT `acctuniqueid`
            FROM radacct
            GROUP BY `acctuniqueid`
            HAVING COUNT(`acctuniqueid`) > 1
        ) x
    )
;

中介 SELECT 是 MySQL 忽略直接子 select.

中相同 table 引用所必需的

请注意在删除之前执行完整 table 备份。