【发布时间】:2013-03-14 04:48:47
【问题描述】:
我有两个表,我想使用它们来确定 stream_post 的“受欢迎程度”。 Stream_Post_Comment 和 Stream_Post_Like。
stream_post_comment_id stream_post_id user_id
1 1 1
2 2 1
3 2 4
4 2 1
stream_post_like_id stream_post_id user_id
1 1 1
2 2 3
3 3 2
4 3 1
我无法将一个查询概念化,该查询会输出如下内容:
stream_post_id popularity
1 1
2 3
3 2
user_id 在给定帖子的流行度得分中只计入一次。例如,如果他们评论并喜欢某个帖子,他们只会算作“1”人气得分。
【问题讨论】: