这是我第一次编写存储过程。这是我的存储过程
CREATE DEFINER=`test`@`%` PROCEDURE `List`(OUT id INT, OUT SCORE INT)
BEGIN
select (Listing.Viewcount * 0.4) + count(Bookmarks.ListingId * 0.6) As Score INTO SCORE, distinct(Listing.ListingId) INTO id
from Listing,Bookmarks
where Listing.ListingId = Bookmarks.ListingId
group by Listing.ListingId
order by Score desc
Limit 10;
END
它在select语句上给出了一个错误,提示“语法错误:意外(明显)不同”。我不知道为什么这是错误的?
非常感谢您的帮助! :)
谢谢。
最佳答案
CREATE DEFINER=`test`@`%` PROCEDURE `List`(OUT id INT, OUT SCORE INT)
BEGIN
select (Listing.Viewcount * 0.4) + count(Bookmarks.ListingId * 0.6),distinct(Listing.ListingId)
INTO SCORE, id
from Listing,Bookmarks
where Listing.ListingId = Bookmarks.ListingId
group by Listing.ListingId
order by Score desc
Limit 1;
END