60 lines
3.3 KiB
Plaintext
60 lines
3.3 KiB
Plaintext
Select
|
|
roundtime,inducted_count,sorted_count,destinv_count,destfull_count,unexpected_count,destfault_count,destfault_count,divfail_count,gaperr_count,
|
|
lost_count, trackerr_count, unknownn_count, unsafe_count,destdis_count, destnone_count, assigned_count,
|
|
|
|
inducted_count/inducted_count as inducted_perc,
|
|
sorted_count/inducted_count as sorted_perc,
|
|
destinv_count/inducted_count as destinv_perc,
|
|
destfull_count/inducted_count as destfull_perc,
|
|
unexpected_count/inducted_count as unexpected_perc,
|
|
destfault_count/inducted_count as destfault_perc,
|
|
divfail_count/inducted_count as divfail_perc,
|
|
gaperr_count/inducted_count as gaperr_perc,
|
|
lost_count/inducted_count as lost_perc,
|
|
trackerr_count/inducted_count as trackerr_perc,
|
|
unknownn_count/inducted_count as unknown_perc,
|
|
unsafe_count/inducted_count as unsafe_perc,
|
|
destdis_count/inducted_count as destdis_perc,
|
|
destnone_count/inducted_count as destnone_perc,
|
|
assigned_count/inducted_count as assigned_perc,
|
|
|
|
inducted_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as inducted_rate,
|
|
sorted_count*3600/TIMESTAMPDIFF(second,:starttime, :endtime) as sorted_rate,
|
|
destinv_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as destinv_rate,
|
|
destfull_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as destfull_rate,
|
|
unexpected_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as unexpected_rate,
|
|
destfault_count*3600/TIMESTAMPDIFF(second,:starttime, :endtime) as destfault_rate,
|
|
divfail_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as divfail_rate,
|
|
gaperr_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as gaperr_rate,
|
|
lost_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as lost_rate,
|
|
trackerr_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as trackerr_rate,
|
|
unknownn_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as unknown_rate,
|
|
unsafe_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as unsafe_rate,
|
|
destdis_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as destdis_rate,
|
|
destnone_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as destnone_rate,
|
|
assigned_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as assigned_rate
|
|
FROM
|
|
(SELECT
|
|
COUNT(*) AS inducted_count,
|
|
SUM(alltable.ACTUAL_DEST <> 'S03999') AS sorted_count,
|
|
SUM(alltable.DivertStatus = 7) AS destinv_count,
|
|
SUM(alltable.DivertStatus = 5) AS destfull_count,
|
|
SUM(alltable.DivertStatus = 2) AS unexpected_count,
|
|
SUM(alltable.DivertStatus = 6) AS destfault_count,
|
|
SUM(alltable.DivertStatus = 14) AS divfail_count,
|
|
SUM(alltable.DivertStatus = 4) AS gaperr_count,
|
|
SUM(alltable.DivertStatus = 17) AS lost_count,
|
|
SUM(alltable.DivertStatus = 3) AS trackerr_count,
|
|
SUM(alltable.DivertStatus = 1) AS unknownn_count,
|
|
SUM(alltable.DivertStatus = 21) AS unsafe_count,
|
|
SUM(alltable.DivertStatus = 12) AS destdis_count,
|
|
SUM(alltable.DivertStatus = 16) AS destnone_count,
|
|
SUM(alltable.DEST_REQ ) AS assigned_count,
|
|
FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(alltable.t_stamp) / 60) * 60) roundtime
|
|
|
|
|
|
FROM alltable
|
|
Where (alltable.t_stamp BETWEEN :starttime AND :endtime) AND ('S03' = :Sorter)
|
|
Group BY FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(alltable.t_stamp) / 60) * 60)
|
|
Order By alltable.t_stamp ASC
|
|
) okey |