"Project nr" "Task" "Task deadline" "Task Type Production"
456 pack 1 april 2013 Pack
456 Leave production 3 april 2013 Leave Production
456 Flight date 9 april 2013 Flight Date
123 pack 1 april 2013 Pack
123 Leave production 6 april 2013 Leave Production
123 Flight date 9 april 2013 Flight Date
789 pack 1 april 2013 Pack
789 Leave production 9 april 2013 Leave Production
789 Flight date 9 april 2013 Flight Date
こんにちは、私の現在のクエリの下です。上記のように、3つのグループにとどまるように、休暇の生産時に日付でソートされた3行で表示するにはどうすればよいですか。プロジェクトID番号はグループにとどまる必要があり、グループは休暇の作成時にソートする必要があります。
SELECT MSP_EpmProject_UserView.[Project nr]
,max(CASE WHEN [Task Type Production] = 'Packed' THEN [Task deadline] END) AS Pack
,max(CASE WHEN [Task Type Production] = 'Leave Production' THEN [Task deadline]
END) AS [Leave Production]
,max(CASE WHEN [Task Type Production] = 'Flight Date' THEN [Task deadline]
END) AS [Flight Date]
FROM MSP_EpmProject_UserView LEFT JOIN MSP_EpmTask_UserView ON
MSP_EpmProject_UserView.ProjectUID = MSP_EpmTask_UserView.ProjectUID LEFT JOIN
MSP_EpmAssignment_UserView ON MSP_EpmTask_UserView.TaskUID =
MSP_EpmAssignment_UserView.TaskUID LEFT JOIN MSP_EpmResource_UserView ON
MSP_EpmAssignment_UserView.ResourceUID = MSP_EpmResource_UserView.ResourceUID
WHERE (MSP_EpmTask_UserView.TaskIsProjectSummary = 0) GROUP BY
MSP_EpmProject_UserView.[Project nr]