delete from source_device_online where deviceOnlineId in (SELECT deviceOnlineId FROM (select deviceOnlineId FROM source_device_online GROUP BY deviceId HAVING COUNT(deviceId) > 1 ) as a);
注:1、update和select不能直接在同一条sql中使用,需要再select一下才可以
2、在做多表查询,或者查询的时候产生新的表的时候会出现这个错误:Every derived table must have its own alias(每一个派生出来的表都必须有一个自己的别名)