gpt4 book ai didi

mysql - 我们可以根据某些条件从同一个表中删除吗?

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

我尝试执行下面的查询,但它指示 SQL 语法错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'd1where d1.num='7' and time in (select time from dummy2 d 2 whe' at line 1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:

有什么建议吗?

请注意,删除操作是在同一个表上执行的。

delete from dummy2 d1 where d1.num='7' and time in (select time from dummy2 d2 where d2.num='5') ;

最佳答案

delete i1.*
FROM dummy2 AS i1
JOIN dummy2 AS i2 ON i2.time = i1.time
WHERE i1.num='7' and i2.num='5';

关于mysql - 我们可以根据某些条件从同一个表中删除吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50731469/

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