I have 2 SQL queries both of which get the counts for different IDs.
select @cntCM_CMQ = count(*)
from dbo.CaseWorkflow cw
join vew_CasePersonnelSystemIDs vcps on cw.ID_Case = vcps.ID_Case
join dbo.WorkflowStates ws on ws.ID_WorkflowState = cw.ID_WorkflowState
where CMSUID = @nSUID and ws.ID_WorkflowType = 3 -- CMQ
select @cntCM_PRWK = count(*)
from dbo.CaseWorkflow cw
join vew_CasePersonnelSystemIDs vcps on cw.ID_Case = vcps.ID_Case
join dbo.WorkflowStates ws on ws.ID_WorkflowState = cw.ID_WorkflowState
where CMSUID = @nSUID and ws.ID_WorkflowType = 1 -- PAPERWORK
It seems that I should be able to combine them into a single select (perhaps with a CASE
statement), but I can't seem to crack it.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…