功能 #75
半小时报表需求
描述
平台默认是15分钟报表以及小时报,日报;
半小时报表需求一般都是单独开发;
由此设计一个逻辑,直接由15分钟报表一次查询得到半小时报;
注: reporttime_start_hour            表示小时
     reporttime_start_halfhour_flag   表示小时标志(0表示前半小时,1表示后半小时)
例如:
SELECT agentid,taskid,reporttime_start_hour,reporttime_start_halfhour_flag,SUM
FROM
(
    SELECT 
        agentid          AS agentid,
        taskid           AS taskid,
        reportTime_start     AS reporttime_start,
        reporttime              AS reporttime,
        allcnt                    AS allcnt,
        SUBSTR              AS reporttime_start_hour,
        IF>15,1,0 )     AS reporttime_start_halfhour_flag
    FROM  report_agent 
    WHERE allcnt>3
    AND agentid='0000101000056590' 
    AND reporttime_start >='20181001000000' 
    AND reporttime_start < '20191101000000' 
) report_agent_half_hour
GROUP BY agentid,taskid,reporttime_start_hour,reporttime_start_halfhour_flag