炸裂这一步想必大家都会把,我就省去了。。 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

相关推荐

迟缓的斜杠青年巴比Q...:简历被投过的公司卖出去了,我前两天遇到过更离谱的,打电话来问我有没有意向报班学Java学习,服了,还拿我学校一个学长在他们那报班学了之后干了华为OD当招牌
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务