Mysql, SubQuery problems -
select rating_id, average_rating (select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50) having average_rating > 4 ;
after running query, error
every derived table must have own alias
i know section here works:
select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50
what doing wrong in subquery? searched , searched , searched couldn't find mistake, no matter corrected, still errors
put "as somealias" after subquery:
select rating_id, average_rating (select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50) having average_rating > 4 ;
Comments
Post a Comment