delete from lsk_question where
titlein (select
titlefrom (select
titlefrom lsk_question WHERE
chapter_name='综合练习' group by
titlehaving count(
title)>1)a) and id not in (select id from(select min(id) as id from lsk_question WHERE
chapter_name='综合练习' group by
titlehaving count(
title)>1)b)
在操作这条去重语句时,mysql报错:1205 - Lock wait timeout exceeded; try restarting transaction
查了资料后发现是因为有其他的语句正在执行,但是没有commit.
我猜测我的原因可能是有其他的操作正在往数据库存储数据没有commit,导致的超时,等待其他线程释放锁。
后来我等我的另外的操作执行完成后试着重新执行,但是还是这个错误,暂时还没有解决,希望有路过的大佬帮忙解答
最终解决方案:重启数据库
记录下错误,请见谅