得到下表结构。
表格1
ServiceID Activity_type Start_date End_date
1 Long Day Care 12/03/2012 12/03/2020
1 Family Day Care 12/03/2012 12/03/2020
2 Vacation Care 12/05/2012 12/03/2020
2 Before School Care 12/05/2012 12/03/2020
3 Long Day Care 12/09/2012 12/03/2020
3 Vacation Care 12/09/2012 12/03/2020
3 After School Care 12/09/2012 12/03/2020
现在我想Activity_type
在服务没有 Activity 时显示空白,例如获取所有不同的Activity_type
内容,如果服务没有该活动,则使用ServiceId , Start_date, End_Date
和空白显示记录Activity_type
。我想要每个服务的总行数 = 不同活动类型的总数。
输出应如下所示。每个服务有五行,因为此处不同活动类型的总数为 5。
ServiceID Activity_type Start_date End_date
1 Long Day Care 12/03/2012 12/03/2020
1 Family Day Care 12/03/2012 12/03/2020
1 12/03/2012 12/03/2020
1 12/03/2012 12/03/2020
1 12/03/2012 12/03/2020
2 Vacation Care 12/05/2012 12/03/2020
2 Before School Care 12/05/2012 12/03/2020
2 12/05/2012 12/03/2020
2 12/05/2012 12/03/2020
2 12/05/2012 12/03/2020
3 Long Day Care 12/09/2012 12/03/2020
3 Vacation Care 12/09/2012 12/03/2020
3 After School Care 12/09/2012 12/03/2020
3 12/09/2012 12/03/2020
3 12/09/2012 12/03/2020
有什么帮助???