Mysql函数getLastMediaId()

`BEGIN
DECLARE Lid INT;
select id into Lid FROM projectmedia order by id desc limit 1;
RETURN(Lid);
END`


mysql程序

`BEGIN   DECLARE lid INT;
IF last_id=0 THEN SET lid=getLastMediaId();
ELSE SET lid=last_id;
END IF;
SELECT * FROM projectmedia WHERE id < last_id ORDER BY id DESC LIMIT 5;
END`

最佳答案

我将WHERE id

SELECT * FROM projectmedia WHERE id < lid ORDER BY id DESC LIMIT 5;

关于mysql - MySQL说:文档#2014-命令不同步;您现在不能运行此命令,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43085041/

10-12 05:36