时间:2021-07-01 10:21:17 帮助过:23人阅读
例如下面这个sql: 报错
DELETE from monthxl where dateTime in ( SELECT a.dateTime from monthxl a where a.dateTime !=( select max(b.dateTime) from monthxl b where a.month=b.month ) )
修改如下:
DELETE FROM monthxl where dateTime in
( select b.dateTime from ( -- 用临时表 包装一层 再删除 SELECT a.month,a.dateTime from monthxl a where a.dateTime !=( select max(b.dateTime) from monthxl b where a.month=b.month ) ) b )
mysql delete 注意
标签:mon 报错 blog max log highlight 注意 pre 临时表