Código SQL:
Ver originalDELIMITER $$
CREATE PROCEDURE sorteo
BEGIN
CREATE TEMPORARY TABLE usersorteo
AS
SELECT nombre
FROM usuarios
WHERE `user`NOT IN (SELECT `user` FROM aleatorio)
ORDER BY rand() LIMIT 2;
INSERT INTO aleatorio
SELECT *
FROM usersorteo;
SELECT *
FROM usersorteo;
END$$