I have a stored procedure like this:
CREATE PROCEDURE `RankAll`()
LANGUAGE SQL
NOT DETERMINISTIC
READS SQL DATA
SQL SECURITY INVOKER
COMMENT ''
BEGIN
select userID,sum(score) as score,@rank := @rank + 1 AS rank from
(
select userID,score from ScoreMessages
union all
select userID,score from ScoreExams
) as scores
JOIN (SELECT @rank := 0) rank
group by userID
order by score desc;
END
Actually I wanted to use it as a view but I have variables because I wanted to rank them and it did not let me to use it in a view.
I tried the query below but it is not correct:
select * from (Call `RankAll`())
So how can I select multiple columns out of it?