Garima Bansal

Garima Bansal

  • 1.1k
  • 680
  • 39.6k

count data and sum of data

Apr 15 2024 11:20 AM

in code, i am using .net repeater to get the data and I want the sum of the total application by SQL query,

SELECT sec.Id, Sec.Name as SName
    ,CASE WHEN SUM(DAS.Approved) IS NULL THEN 0 ELSE SUM(DAS.Approved) END as Approved 
    ,CASE WHEN Sum(DAS.Pending) IS NULL THEN 0 ELSE SUM(DAS.Pending) END as Received
    ,CASE WHEN SUM(UnderProcess) IS NULL THEN 0 ELSE SUM(Process) END as UnderProcess
    FROM [dbo].[Sectors] Sec
    LEFT JOIN [dbo].[PMasters] AS A
        ON Sec.Id = A.AltSectorId
    LEFT JOIN D_AStatistics AS DAS
        ON A.Id = DAS.ActivityID
        GROUP BY Sec.Name,Sec.Id
        order by 1

 

 

How I can I do?

 


Answers (3)