为什么这个MySQL查询不起作用?

为什么这个MySQL查询不起作用?,sql,mysql,database,Sql,Mysql,Database,mysql 错误1205(HY000):超过锁定等待超时;尝试重新启动事务或者尝试单独执行 create temporary table t2 select min(id) from mycontent group by download_link; 值得一试。也许可以试着分开做 create temporary table t2 select min(id) from mycontent group by download_link; 值得一试。据我所知,您需要为查

mysql


错误1205(HY000):超过锁定等待超时;尝试重新启动事务

或者尝试单独执行

create temporary table t2 
select min(id) 
from mycontent 
group by download_link;   

值得一试。

也许可以试着分开做

create temporary table t2 
select min(id) 
from mycontent 
group by download_link;   

值得一试。

据我所知,您需要为查询选择分组字段以使其有意义。你想要完成的是什么

想象一下这张桌子:

1) create temporary table t2;

2) select min(id) from mycontent group by download_link;   
这将使用您的查询选择

download_link, id
-----------------
''           , 3
'foo'        , 3

因此,请解释您的锁定问题,因为第1行已被事务锁定,但需要被第2行替换。

据我所知,您需要为查询选择分组字段以使其有意义。你想要完成的是什么

想象一下这张桌子:

1) create temporary table t2;

2) select min(id) from mycontent group by download_link;   
这将使用您的查询选择

download_link, id
-----------------
''           , 3
'foo'        , 3

因此,请解释您的锁定问题,因为第1行已被事务锁定,但需要被第2行替换。

您的
mycontent
表在尝试从中选择时可能被其他事务锁定。

您的
mycontent
表在尝试选择时可能被其他事务锁定从中选择。

mycontent表有多大?我在这里猜测,但是groupby子句不是多余的吗?mycontent表有多大?我在这里猜测,但是groupby子句不是多余的吗?