gpt4 book ai didi

mysql - 在 MySQL 中使用 WHERE EXISTS 删除查询

转载 作者:行者123 更新时间:2023-11-28 23:27:20 26 4
gpt4 key购买 nike

<分区>

我正在使用 MySql 中的一个表执行带有“where exists”的查询。它适用于 SELECT *,但当我尝试执行 DELETE 而不是 SELECT * 时失败。

如何使用删除执行相同的查询?非常感谢!

select * from MyTable t1 where exists ( 
select * from MyTable t2 where t1.user_id = t2.user_id
and t1.object_id <> t2.object_id and t2.role = "ADMIN")
and role = "ORG_MANAGER"
and object_type = "type_b";

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