gpt4 book ai didi

mysql - 从表 B 中删除表 A 中不存在的值

转载 作者:行者123 更新时间:2023-11-29 23:13:47 25 4
gpt4 key购买 nike

我正在尝试在 MySQL 中完成以下任务:

delete from table_b where table_b.token is not found in table_a.token 

说明:

两个表都有一个名为token的列。

如果token中不存在table_b中的token,我想删除table_b上的所有记录table_a 中的列。

最佳答案

使用子查询:

delete from table_b where token not in (select token from table_a)

关于mysql - 从表 B 中删除表 A 中不存在的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27950735/

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