BNA8/.resources/a4f84ffbf9a57d3f4212257ee9b7c10705bfd8ded615d709bc57f7cad8e3f9e3

33 lines
1.4 KiB
Plaintext

Select
day,
SorterName,ScannerName,Total_count,
GoodRead_count,NoRead_count,MultiLabelRead_count,NoCode_count,Startstamp,Endtstamp,
1 as Total_perc,
GoodRead_count/Total_count as GoodRead_perc,
NoRead_count/Total_count * 100 as NoRead_perc,
MultiLabelRead_count/Total_count * 100 as MultiLabelRead_perc,
NoCode_count/Total_count * 100 as NoCode_perc,
Total_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as Total_rate,
GoodRead_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as GoodRead_rate,
NoRead_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as NoRead_rate,
MultiLabelRead_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as MultiLabelRead_rate,
NoCode_count*3600/TIMESTAMPDIFF(second, Startstamp, Endtstamp) as NoCode_rate
FROM
(SELECT
date(alltable.t_stamp) as day,
'S03' as SorterName,
'S03aa' as ScannerName,
MIN(alltable.t_stamp) AS Startstamp,
Max(alltable.t_stamp) AS Endtstamp,
COUNT(*) AS Total_count,
SUM(SUBSTRING(alltable.ScanLabel,1,1) <> '?' AND
SUBSTRING(alltable.ScanLabel,1,1) <> '9' AND
SUBSTRING(alltable.ScanLabel,1,1) <> '0') AS GoodRead_count,
SUM(SUBSTRING(alltable.ScanLabel,1,1) = '?') AS NoRead_count,
SUM(SUBSTRING(alltable.ScanLabel,1,1) = '9') AS MultiLabelRead_count,
SUM(SUBSTRING(alltable.ScanLabel,1,1) = '0') AS NoCode_count
FROM alltable
Where (alltable.t_stamp BETWEEN :starttime AND :endtime)
GROUP BY day(alltable.t_stamp)) basa