下面是我创建 SP 的代码,该 SP 将从表中检索高分列表。MySQL 一直告诉我它无法创建存储过程并检查我的语法,即使我可以在没有存储过程的情况下在表上正常运行查询。任何帮助将不胜感激
USE `froggame`;
DROP procedure IF EXISTS `sp_GetHighScores`;
DELIMITER $$
USE `froggame`$$
CREATE PROCEDURE `froggame`.`sp_GetHighScores` (
IN p_StartFrom INT)
BEGIN
SELECT
h.PlayerName,
h.Score,
h.Accuracy,
h.TimePlayed,
@rownum := @rownum + 1 as Rank
FROM
HighScores h
JOIN
(SELECT @rownum := 0) r
ORDER BY
h.Score DESC
LIMIT 50 OFFSET p_StartFrom;
END
$$
DELIMITER ;
谢谢,
戴夫