绕过DELETE查询中的自引用 [英] Get around self-referencing in a DELETE query

查看:72
本文介绍了绕过DELETE查询中的自引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试删除所有不是其名称下最新版本的记录,但是显然您无法引用访问您在同一查询中修改的表.

I'm trying to delete all records which aren't the latest version under their name but apparently you can't reference access a table you are modifying in the same query.

我尝试了此操作,但由于上述原因,该方法不起作用:

I tried this but it doesn't work for the reasons above:

DELETE FROM table
WHERE CONCAT(name, version ) NOT IN (
SELECT CONCAT( name, MAX( version ) )
FROM table
GROUP name
)

我该如何解决?

欢呼

推荐答案

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆