Need help for my SQL query

后端 未结 3 615
情话喂你
情话喂你 2021-01-25 09:42

Well I may have posted this earlier also, but unable to find the answer so far, so please help me on this one.

My database structure:

ATT (

3条回答
  •  时光取名叫无心
    2021-01-25 10:29

    SELECT 
          E1.F_Name AS A, 
          P1.Project_Name AS B, 
          Count(A1.Act_ID) AS C, 
          sum( IF( A1.Status IN ( 'Closed', 'OnHold' ), 0, 1 )) as D,
          (Count(A1.Act_ID) / sum( IIF( A1.Status IN ( 'Closed', 'OnHold' ), 0, 1 ))) * 100 as E
       FROM 
          ATT_Table A1
             JOIN Employee_Table E1
                ON A1.Assigned_To_ID = E1.Emp_ID
             JOIN Project_Table P1
                ON A1.Project_ID = P1.Project_ID
       GROUP BY 
          F_Name, Project_Name;
    

提交回复
热议问题