Sql 每位主办方接待的客人的平均年龄是多少?

Sql 每位主办方接待的客人的平均年龄是多少?,sql,Sql,这是我使用的两个数据表 类似这样的内容: select A.from_user, sum(B.age) / sum(1.0) as average_age, from A inner join B on A.to_user = B.guest_id where from_type = 'host' and to_type='guest' group by A.from_user 欢迎来到StackOverflow!参观,坐下来看看。请提供答案,以便我们更好地回答您的问题。谢谢

这是我使用的两个数据表

类似这样的内容:

select 
  A.from_user, 
  sum(B.age) / sum(1.0) as average_age,
from A 
inner join B on A.to_user = B.guest_id
where from_type = 'host' and to_type='guest'
group by A.from_user

欢迎来到StackOverflow!参观,坐下来看看。请提供答案,以便我们更好地回答您的问题。谢谢