我有以下过程说明can't reopen table
为什么会出现此错误。这是查询:
DECLARE rangee INT;
DECLARE uid BIGINT;
SET @rangee = plimitRange * 10;
SET @uid = puserid;
DROP TEMPORARY TABLE IF EXISTS Rangee;
CREATE TEMPORARY TABLE Rangee(max BIGINT,min BIGINT);
PREPARE STMT FROM
'INSERT INTO Rangee
select max(postid),MIN(postid) from
(
select wall.postid from wall,posts where
wall.postid = posts.postid and posts.userid=?
order by wall.postid desc LIMIT 10 OFFSET ?
)m;
';
EXECUTE STMT USING @uid,@rangee;
DEALLOCATE PREPARE STMT;
select comments.comment,comments.postid,user.name,comments.userid
from user,posts,comments where
posts.postID = comments.postid and
comments.postid<=(select max from Rangee) and
comments.postid>=(select min from Rangee) and posts.userid = puserid and
user.userid=comments.userid order by comments.postid desc;
在这里,我从另一个表中插入值min
和max id's
临时表,以便我可以使用这些值在最终查询中检索我的数据。但是在我指定范围的最终查询中,即包含(select max from Rangee)
并(select min from Rangee)
给出此错误的行.我该如何解决它。最小值和最大值的值返回正常。