mySQL 单表删除低于平均分以下的所有数据

delete from t_table where num < ( select avg(num) from
t_table)
执行报错。哪里错了吗?还是有其他方法?

不能先select出同一表中的某些值,再update/delete这个表(在同一语句中)
楼上说的是一种解决方法,也可以这样写,两种都可以
delete from t_table where num < (select avg(num) as num from (select * from t_table)c);
delete from t_table where num < (select * from (select avg(num) as num from t_table)v);
注:as num和最后的c或v别忘记

哦,我知道了,你子查询和删除是一个表,所以不能写在一起,你需要把平均值查询好,然后再删除
set @a = (select avg(num) from t_table);
delete from t_table where num < a;

num是数字类型么?没看出什么错误来。

@caoshy
蓝色是选中代码,下面是报错内容图片