22,298
社区成员
发帖
与我相关
我的任务
分享
SELECT plant, case when ProjectName Is Null then 'not allocated' else ProjectName end AS Project
FROM qry_user_segment INNER JOIN (qry_investtracking INNER JOIN
investdoc_status ON qry_investtracking.IA_Request_status = investdoc_status.inv_d_status) ON
(qry_user_segment.plant = qry_investtracking.plant) AND
(qry_user_segment.segment = qry_investtracking.segment)
PIVOT (
SUM(Outlook2011) for
investdoc_status.inv_d_status_ap_group In ("Not started","in preparation","in approval","approved but not ordered","PO released","Assets arrived at Schaeffler")
) as p
GROUP BY plant