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行。