全部评论
谢谢呀
用union/union all的话只能用一个order by在最后。而且你不能用count start time 来判断次数,比如第二行和第四行是相同的开始时间。 我贴一个我的答案,欢迎指正 select c.tid, count(distinct c.uid) as uv, count(c.id) as pv from ( select a.id, a.uid, a.exam_id as tid from exam_record a union all select b.id, b.uid, b.question_id as tid from practice_record b ) c group by c.tid order by uv, pv desc
相关推荐
07-03 14:11
广西大学 渠道销售 点赞 评论 收藏
分享