create proc [dbo].[Issue_Log_App_Pie]
asbegin
declare @NonSAP numeric(8,2)declare @SAP numeric(8,2)declare @LMDM numeric(8,2)declare @Total numeric(8,2)create table #AppPie(App Varchar(50),Ticket Numeric(8,2))set @NonSAP =(SELECT count(*) as TOTAL_ISSUE from showissuelog where Application_Type_Id=2GROUP BY APPLICATION_TYPE) set @SAP=(SELECT count(*) as TOTAL_ISSUE from showissuelog where Application_Type_Id=1 and Application_id not in (3)GROUP BY APPLICATION_TYPE)set @LMDM=(SELECT count(*) as TOTAL_ISSUE from showissuelog where Application_Type_Id=1 and Application_id in (3)GROUP BY APPLICATION_TYPE)set @Total=(@NonSAP+@SAP+@LMDM)set @NonSAP=(@NonSAP/@Total)*100set @SAP=(@SAP/@Total)*100set @LMDM=(@LMDM/@Total)*100insert into #AppPie values ('Non SAP',@NonSAP)insert into #AppPie values ('SAP',@SAP)insert into #AppPie values ('LMDM',@LMDM)select * from #AppPieend
No comments:
Post a Comment