如何解决MySQL WHERE LIKE语句:如何删除表中的列子字符串不等于所需子字符串的行?
我想删除kontext(column_name)值,该值的substrinct与fmea值不同于null的substrinct不同。我可以通过此查询选择这些值:
select *
FROM fmea001
where substring_index(kontext,".",1)
not in (Select substring_index(kontext,1)
from fmea001
where fmea is not null
and lkey = 9)
但是,当我尝试删除
delete *
FROM fmea001
where substring_index(context,1)
not in (Select substring_index(context,1)
from fmea001
where fmea is not null
and lkey = 9))
我收到此错误
解决方法
MySQL并不支持在子查询中重新响应正在修改的表(更新或删除的表)。
如果我正确地跟随您,则可以将其写为反左联接:
delete f
from fmea001 f
left join fmea001 f9
on substring_index(f9.kontext,'.',1) = substring_index(f.kontext,1)
and f9.fmea is not null
and f9.lkey = 9
where f9.fmea is null
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。