AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-21 : 22:03:21
|
Gary writes "I need to get the sum of this storedprocedure:SELECT COUNT(MedStatus) * .75 as rest FROM BodyOpsList WHERE medstatus In('WRes75','Wrin75','Pres75','Prin75')AND CostCenter =@costcenter and tmptransfercostcenter is null OR medstatus In('WRes75','Wrin75','Pres75','Prin75') AND TMPTRANSFERCostCenter =@costcenter union ALL SELECT COUNT(MedStatus) * .50 FROM BodyOpsList WHERE medstatus In('WRes50','Wrin50','Pres50','Prin50') AND CostCenter =@costcenter and tmptransfercostcenter is null OR medstatus In('WRes50','Wrin50','Pres50','Prin50') AND TMPTRANSFERCostCenter =@costcenter UNION ALL SELECT COUNT(MedStatus) * .25 FROM BodyOpsList WHERE medstatus In('WRes25','Wrin25','Pres25','Prin25') AND CostCenter =@costcenter and tmptransfercostcenter is null OR medstatus In('WRes25','Wrin25','Pres25','Prin25') AND TMPTRANSFERCostCenter =@costcenter UNION ALL SELECT COUNT(MedStatus) FROM BodyOpsList WHERE medstatus IN ('WRES100','WRIN100', 'PRES100', 'WMOD','WDoJo', 'PDoJo', 'PRIN100', 'AWP', 'WJPC', 'PJPC') AND COSTCENTER ='GW310' and tmptransfercostcenter is null OR medstatus IN ('WRES100','WRIN100', 'PRES100', 'WMOD','WDoJo', 'PDoJo', 'PRIN100', 'AWP', 'WJPC', 'PJPC') AND TMPTRANSFERCOSTCENTER =@costcenterIs there a better way to write this?" |
|