gpt4 book ai didi

mysql - 使用标准偏差删除异常值

转载 作者:太空宇宙 更新时间:2023-11-03 12:34:53 26 4
gpt4 key购买 nike

我使用下面的查询来删除离群值(1.5 倍 sd)。

DELETE FROM sv_condition_sw 
WHERE snow_mountain > (
SELECT AVG(snow_mountain)+1.5*STDDEV(snow_mountain)
FROM sv_condition_sw
WHERE lud='2012-11-28' AND res_id=769)
AND lud='2012-11-28'
AND res_id=769

但是它给出了这个错误:

查询:delete FROM sv_condition_sw WHERE snow_mountain > (SELECT AVG(snow_mountain)+1.5*STDDEV(snow_mountain) FROM sv_condition_sw WHER...

Error Code: 1093
You can't specify target table 'sv_condition_sw' for update in FROM clause

不知道是什么意思。

最佳答案

你可以用另一个子选择来欺骗 MySQL 来做到这一点

DELETE FROM sv_condition_sw 
WHERE snow_mountain > (select * from (SELECT AVG(snow_mountain)+1.5*STDDEV(snow_mountain)
FROM sv_condition_sw
WHERE lud='2012-11-28'
AND res_id=769) x)
AND lud='2012-11-28' AND res_id=769

关于mysql - 使用标准偏差删除异常值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13631344/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com