有一張錯誤上報表,下面只將與本文相關的字段羅列如下:上報人(ReportPerson)、上報錯誤ID(ErrorID)、上報時間(ReportTime)、狀態(State),其中值為0(未解決)、1(已處理)、2(已解決)。
現在要做的是統計在某個時間段[beginTime,endTime](其中beginTime,endTime由前臺進行傳入)內,每個上報人上報錯誤點的總數以及已解決錯誤的總數。
1 select a.ReportPerson,a.sumOfError,b.solvedError
from ( select COUNT (ErrorID) as sumOfError,ReportPerson
from PCR_ConstructInfo
where
(ReportTime > beginTime) and (ReportTime < endTime) group by ReportPerson)
a left join
( select ReportPerson, COUNT (ErrorID) as solvedError
from PCR_ConstructInfo
where (State = 2 ) and (ReportTime > beginTime) and (ReportTime < endTime) group by ReportPerson) b
on (a.ReportPerson = b.ReportPerson)
生成的結果圖為:
?
?
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
