Hi i'm trying to create a SQL function but keep getting error code: 1172 Result Consisted of more than one row. Is there anyone who have an idea of what is wrong in the code. I want the function to calculate the avg agelimit and show the games which is over the avg. The results should consist of 18 values.
My code:
Delimiter // CREATE FUNCTION fAgeLimit2() returns varchar(1000) BEGIN DECLARE GameName varchar(1000); SELECT DISTINCT game.name into GameName from game, genre, hasgenre WHERE game.name = hasgenre.GameName AND hasgenre.GenreName = genre.Name AND AgeLimit > (SELECT AVG(AgeLimit) FROM genre); return GameName; END //