BNA8/.resources/4a7b0afbfc6dc0278b94d2cefb7ed4943274d69c3446ffcf04ebbcb2ba695e2e

35 lines
1.5 KiB
Plaintext

Select
roundtime,Total_count,GoodRead_count,NoRead_count,MultiRead_count,NoCode_count,
Total_count/Total_count as Total_perc,
GoodRead_count/Total_count as GoodRead_perc,
NoRead_count/Total_count as NoRead_perc,
MultiRead_count/Total_count as MultiLabelRead_perc,
NoCode_count/Total_count as NoCode_perc,
Total_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as Total_rate,
GoodRead_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as GoodRead_rate,
NoRead_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as NoRead_rate,
MultiRead_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as MultiLabelRead_rate,
NoCode_count*3600/TIMESTAMPDIFF(second, :starttime, :endtime) as NoCode_rate
FROM
(Select
alltable.t_stamp AS t_stamp,
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 MultiRead_count,
SUM(SUBSTRING(alltable.ScanLabel,1,1) = '0') AS NoCode_count,
FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(alltable.t_stamp) / 60) * 60) roundtime
FROM alltable
Where (alltable.t_stamp BETWEEN :starttime AND :endtime) and ('S03aa' = :Scanner)
Group BY FROM_UNIXTIME(CEIL(UNIX_TIMESTAMP(alltable.t_stamp) / 60) * 60)
Order By alltable.t_stamp ASC
) okey