I'm trying to create a store procedure in mysql and it is giving me errors and I don't know why since the sql code works just find.
Here is the sql code:
CREATE TEMPORARY TABLE IF NOT EXISTS table2 AS (
select AVG(Score) as AVG, MovieCode
from UserMovies
group by MovieCode
);
UPDATE Movies
set Score =(
select AVG
from table2
where Movies.Code=table2.MovieCode );
DROP TABLE IF EXISTS table2;
Thanks for the help.