以准备状态运行时出现Mysql语法错误
我有一个存储过程,在这个存储过程中,我使用一个准备好的语句来执行两个查询以准备状态运行时出现Mysql语法错误,mysql,database,stored-procedures,pdo,Mysql,Database,Stored Procedures,Pdo,我有一个存储过程,在这个存储过程中,我使用一个准备好的语句来执行两个查询 SET @uid = puserid; SET @rangee = plimit * 50; SET @post = 'post'; PREPARE STMT FROM ' SELECT notifications.postid,victims.victimid,friends.friendsname,notificationrecievers.status FROM friends,victims,not
SET @uid = puserid;
SET @rangee = plimit * 50;
SET @post = 'post';
PREPARE STMT FROM
'
SELECT notifications.postid,victims.victimid,friends.friendsname,notificationrecievers.status
FROM friends,victims,notifications,notificationrecievers
WHERE victims.postid=notifications.postid
AND notificationrecievers.notificationid=notifications.notid
AND notificationrecievers.recieverid=?
AND notifications.type=?
AND friends.friendsid=victims.victimid
AND notificationrecievers.notificationid <=
(
SELECT MAX(notid) FROM
(
SELECT n.notid FROM user u,notifications n,notificationrecievers nr WHERE
nr.recieverid=? AND u.userid=n.senderid AND nr.notificationid=n.notid ORDER BY n.notid DESC
LIMIT 50 OFFSET ?
)a
)
AND notificationrecievers.notificationid >=
(
SELECT MIN(notid) FROM
(
SELECT n.notid FROM user u,notifications n,notificationrecievers nr WHERE
nr.recieverid=? AND u.userid=n.senderid AND nr.notificationid=n.notid ORDER BY n.notid DESC
LIMIT 50 OFFSET ?
)b
)
ORDER BY notifications.postid DESC;
UPDATE notificationrecievers
SET notificationrecievers.status=1
WHERE notificationrecievers.status=0
AND notificationrecievers.recieverid=?
AND
notificationrecievers.notificationid <=
(
SELECT MAX(notid) FROM
(
SELECT n.notid FROM user u,notifications n,notificationrecievers nr WHERE
nr.recieverid=? AND u.userid=n.senderid AND nr.notificationid=n.notid ORDER BY n.notid DESC
LIMIT 50 OFFSET ?
)e
)
AND
notificationrecievers.notificationid >=
(
SELECT min(notid) FROM
(
SELECT n.notid FROM user u,notifications n,notificationrecievers nr WHERE
nr.recieverid=? AND u.userid=n.senderid AND nr.notificationid=n.notid ORDER BY n.notid DESC
LIMIT 50 OFFSET ?
)g
);
';
EXECUTE STMT USING @uid,@post,@uid,@rangee,@uid,@rangee,@uid,@uid,@rangee,@uid,@rangee;
检查您的MySQL版本。。。直到版本5.5.6,才允许使用参数进行限制或偏移。这些参数在其他查询中工作正常,这不是问题所在
Code: 1064
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 ';
UPDATE
notificationrecievers
SET notificationrecievers.st' at line 25