题解 | #计算用户的平均次日留存率#
某乎问答回答过教育类问题的用户里有多少用户回答过职场类问题
http://www.nowcoder.com/practice/b02cf9ee7b9f4cdda308f8155ff3415d
首先用where筛选出教育和职业的问题类型; group by作者; 满足后having问题类型,值2的就是又写过教育并且写过职业的创作者; 套一层select 计数
select count(*)
from
(select author_id
,count(distinct issue_type) 问题类型
from issue_tb join answer_tb using(issue_id)
where issue_type in ('Education','Career')
group by author_id
having 问题类型=2
) tt