1
在我的MySQL Stoared過程中我想將波紋管查詢的結果存儲到局部變量中。在MYSQL存儲過程中將UNION查詢的結果保存在本地變量中
MySQL的SP
BEGIN
Declare temp_ID bigint;
Declare temp_teamName Text;
(select ID,team1 from tbl_tournament_matches where leveID = 1 and tournamentID = 91 and matchType = 'L')
UNION
(select ID,team1 from tbl_tournament_matches where leveID = 2 and tournamentID = 91 and looserTeam is not null)
ORDER BY RAND() LIMIT 0,1;
select temp_ID, temp_teamName;
END;
如何傳遞查詢的結果爲局部變量? 注意:上面的SP將只返回1行。