1
SELECT sc.CID,sc.CodeName as OverviewText,scRAG.CodeName as RAGStatusText
FROM StatusCode sc
LEFT OUTER JOIN ProjectOverview po ON sc.CID = po.ProjectOverviewCID AND po.ProjectId = 180
LEFT OUTER JOIN StatusCode scRAG ON po.RAGStatusCID = scRAG.CID
WHERE sc.SCID = 18
這上面的代碼的結果罪:我怎樣才能讓數據透視這個選擇?
CID OverviewText RAGStatusText
153 Cost Green
154 Requirements Yellow
155 Schedule NULL
156 Technical NULL
157 Testing NULL
我希望它有10個字段返回一條記錄:
成本,綠色,要求,黃色, 計劃,NULL, 技術, NULL, Testing,NULL
我可以在cid上轉動嗎?
這是[至少你的第6個關鍵問題](http://stackoverflow.com/search?q=user%3A352157+pivot)據我所知。你試過什麼了? – 2011-02-11 16:43:23