create view CertAllErrorUserView
as
select
ID=newid(), --为不实际不存在的唯一列
DeptID,State,State1,ErrorCount,SubmitDate,
Rate=convert( decimal(20,0),(ErrorCount*1.0/(select count(1) from mms_Cert where mms_Cert.JDY=CertErrorUserView.JDY))*100),
AllCount=(select count(1) from mms_Cert where mms_Cert.JDY=CertErrorUserView.JDY)
from CertErrorUserView