找到持续三年的注意力的用户

找到持续三年的注意力的用户

本文介绍了找到持续三年的注意力的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个事件表,其中将存储参与的用户列表。 示例数据: ╔═══════════════════╗b$ b║id║name║year║ $ b $b╠════════════════════b $ b║ 1 ║Arun║ 2001 $ $ b $b║ 2 ║Arun║ 2002 ║║ 3 ║Arun║ 2003 ║║ 4 ║Arun║ 2004 ║║ 5 ║Arun║ 2009 ║║ 6 ║Arun║ 2010 ║║ 7 ║Arun║ 2011 ║$ b $b║ 8 ║Bala║ 2014 ║║ 9 ║Bala║ 2015 ║║ 10 ║巴拉║ 2017 ║║ 11 ║chan║ 2014 ║$ b $b║ 12 ║chan║ 2015 ║$ b $b║ 13 ║chan║ 2018 ║╚═════════════════════════════════════ ═════════════ 我只需找到用户新专栏多年来连续三年参加。即使用户连续参加了6年,也必须分成一列中的前三个,另一列中的下三个。 输出: ╔ ════════════════b $ b║id║name║years║╠══════════ ═╬════════════b $ b║ 1 ║Arun║2001-2003║║ 2 ║Arun║2009-2011║╚════════════════════════════════════════════════════════════ p $ p> 解决方案 I have a event table in which the list of user participated will be stored.Sample Data:╔════╦══════╦══════╗║ id ║ name ║ year ║╠════╬══════╬══════╣║ 1 ║ Arun ║ 2001 ║║ 2 ║ Arun ║ 2002 ║║ 3 ║ Arun ║ 2003 ║║ 4 ║ Arun ║ 2004 ║║ 5 ║ Arun ║ 2009 ║║ 6 ║ Arun ║ 2010 ║║ 7 ║ Arun ║ 2011 ║║ 8 ║ Bala ║ 2014 ║║ 9 ║ Bala ║ 2015 ║║ 10 ║ Bala ║ 2017 ║║ 11 ║ chan ║ 2014 ║║ 12 ║ chan ║ 2015 ║║ 13 ║ chan ║ 2018 ║╚════╩══════╩══════╝I need to find only the user who have attended continuously for three years with the years in new column. Even if the user attended for continuous 6 years then have to split into first three in an column and next three in another column.Output:╔════╦══════╦═══════════╗║ id ║ name ║ years ║╠════╬══════╬═══════════╣║ 1 ║ Arun ║ 2001-2003 ║║ 2 ║ Arun ║ 2009-2011 ║╚════╩══════╩═══════════╝ 解决方案 这篇关于找到持续三年的注意力的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 22:04