炸裂这一步想必大家都会把,我就省去了。。 WITH t AS ( SELECT 'A' AS fr,'B' as too UNION ALL SELECT 'A' ,'C' UNION ALL SELECT 'A' ,'E' UNION ALL SELECT 'B' ,'A' UNION ALL SELECT 'B' ,'F' UNION ALL SELECT 'B' ,'E' UNION ALL SELECT 'C' ,'E' UNION ALL SELECT 'C' ,'F' UNION ALL SELECT 'C' ,'A' ) select concat(t1.fr,'-',t2.fr) as who_and_who,collect_set(t1.too) as comment_love from ( select fr, too, cn from ( select fr, too, count(fr) over (partition by too) as cn from t ) temp where cn > 1 ) t1 join ( select fr, too, cn from ( select fr, too, count(fr) over (partition by too) as cn from t ) temp where cn > 1 ) t2 on t1.fr <t2.fr and t1.too = t2.too GROUP BY concat(t1.fr,'-',t2.fr)
点赞 1

相关推荐

09-22 22:22
中山大学 Java
双尔:赌对了,不用经历秋招的炼狱真的太好了,羡慕了
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务