0

我想通过主键从mysql中删除一条记录,即account_recharge_detail_id。当我使用以下脚本时,它有效: SELECT account_recharge_detail_id FROM account_recharge_detail where operator_name='fanny-test'; (返回 101)从 account_recharge_detail 中删除,其中 account_recharge_detail_id=101;

但是当我将两者结合在一起时: DELETE FROM account_recharge_detail where account_recharge_detail_id in ( SELECT A.account_recharge_detail_id FROM account_recharge_detail as A where A.operator_name='fanny-test')

它返回:错误代码:1093。您不能在 FROM 子句中指定目标表“account_recharge_detail”进行更新

我想用一句话让它工作,我该如何解决?

4

1 回答 1

0

我认为您可以使用 delete from account_recharge_detail where operator_name='fanny-test'; 因为 account_recharge_detail_id 是主键,所以不能为空

于 2018-03-02T01:21:25.667 回答