0

嗨,我正在尝试编写一份报告,显示一个月内的每日值。报告的外观小片段:

                  01-Apr   02-Apr  03-Apr      .  .                               30-Apr 
 Attended Arrivals   1          2      0       .  .                                  1           
 Failed Arrivals     9          0      0                                             1
 Unattended Arrivals 0          5      0       .  .                                  1 

我在下面复制了我的查询,问题是,一个月中可能有几天没有记录,如果我在交叉表中使用 Activity._Created 作为列组,它会跳过中间的几天。关于如何改进查询的任何建议?

SELECT Activity.id, ActivityType.code, Activity._created, IF( Activity. stateId= 686 , 'FAILED Arrivals' , IF(Activity.typeId = 11,'Attended Departures' , 'Unattended Departures' ) ) AS 'type'

从活动

左连接 ActivityType ON ActivityType.id = Activity.typeId

WHERE Activity.typeId = 11 或 Activity.typeId = 12 ORDER BY Activity._created

谢谢

4

0 回答 0