BNA8/.resources/feb07fe337f9015f13e079b9068b9c3926912ede11fe938cc6e26faa58f6b2b1

25 lines
1.5 KiB
Plaintext

Select
SorterName,Induct_count,Sorted_count,OperRecirc_count,MachineRecirc_count,AWCSRecirc_count,Startstamp,Endtstamp,
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,
concat(cast(Induct_count as char),' pph') as Induct_rate,
concat(cast(Sorted_count as char),' pph') as Sorted_rate,
concat(cast(OperRecirc_count as char),' pph') as OperRecirc_rate,
concat(cast(MachineRecirc_count as char),' pph') as MachineRecirc_rate,
concat(cast(AWCSRecirc_count as char),' pph') as AWCSRecirc_rate
FROM
(SELECT
'S03' as SorterName,
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,
MIN(alltable.t_stamp) AS Startstamp,
Max(alltable.t_stamp) AS Endtstamp
FROM alltable
Where (alltable.t_stamp BETWEEN :starttime AND :endtime)
Group BY 'S03') basa