以下のコマンドが動かないので、動くまでレクチャー頂きたいです。動いたら、文の解説をお願いしたいです。
■やりたいことcommentテーブルに保存されている評価値の平均を計算して、hotelテーブルの評価値カラム(star_???)に保存したい
google cloud SQLで動かしています。
■動かないSQL文
UPDATE hotel t1
SET t1.star_all = tmp.star_total, t1.star_price = tmp.star_price t1.review_num = tmp.count_idINNER JOIN ( SELECT comment_id, ave(comment_star_total) AS star_total, ave(comment_star_price) AS star_price, count(comment_id) AS count_id FROM comment where comment_hotel_id=3) tmpON t1.comment_id = tmp.comment_id;