select round(avg(score),3) as avg_score
from(select distinct user_id
    ,score
    from recommend_tb r
    join user_action_tb u
    on r.rec_user = u.user_id 
    where r.rec_info_l = u.hobby_l)t1


首先用user_id连接recommend_tb表和user_action_tb表,通过where语句查询出用户喜好内容hobby_l和推荐内容rec_info_l一致的用户id和分数score。去重distinct,将上述作为子查询t1,主查询直接使用聚合函数av()查询平均分数