假设有两张table, user 以及 comments . 下面是每个表中的字段,用户:
user
comments
userid username
评论:
commentID commentDescription userid
编写一个查询以查找有2条以上评论的用户o/p文件:
userid username commentDescription
mlnl4t2r1#
select u.userid, u.username, c.commentDescription from user u inner join (select c.userid, c.commentDescription, count(*) over(partition by userid) cnt from comments c ) c on u.userid=c.userid and c.cnt>2;
1条答案
按热度按时间mlnl4t2r1#