31 lines
1.7 KiB
Plaintext
31 lines
1.7 KiB
Plaintext
Select
|
|
roundtime,
|
|
Induct_count,Sorted_count,OperRecirc_count,MachineRecirc_count,AWCSRecirc_count,
|
|
|
|
Induct_count/Induct_count as Induct_perc,
|
|
Sorted_count/Induct_count as Sorted_perc,
|
|
OperRecirc_count/Induct_count as OperRecirc_perc,
|
|
MachineRecirc_count/Induct_count as MachineRecirc_perc,
|
|
AWCSRecirc_count/Induct_count as AWCSRecirc_perc,
|
|
|
|
Induct_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as Induct_rate,
|
|
Sorted_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as Sorted_rate,
|
|
OperRecirc_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as OperRecirc_rate,
|
|
MachineRecirc_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as MachineRecirc_rate,
|
|
AWCSRecirc_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as AWCSRecirc_rate
|
|
FROM
|
|
(SELECT
|
|
|
|
COUNT(*) AS Induct_count,
|
|
SUM(alltable.ACTUAL_DEST NOT IN ('S013001', 'S012069', 'S011076')) AS Sorted_count,
|
|
SUM(alltable.ACTUAL_DEST IN ('S013001', 'S012069', 'S011076') AND (alltable.DivertStatus & (4|32|262144|524288|1048576)) > 0) AS OperRecirc_count,
|
|
SUM(alltable.ACTUAL_DEST IN ('S013001', 'S012069', 'S011076') AND (alltable.DivertStatus & (2|8|16|64|8192|16384|131072|2097152)) > 0) AS MachineRecirc_count,
|
|
SUM(alltable.ACTUAL_DEST IN ('S013001', 'S012069', 'S011076') AND (alltable.DivertStatus & (128|256|512|1024|4096|65536)) > 0) AS AWCSRecirc_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 |