我有程序從各種來源提取數據給我3非常相似的表。Union,Join,或GroupBy
Metric | Tickets |Band
______________________________________
Acknowledgement | 45 | New
Acknowledgement | 23 | Within
Acknowledgement | 16 | Near
Acknowledgement | 2 | Very Near
而且
Metric | Tickets |Band
___________________________________
Escalation | 10 | New
Escalation | 43 | Within
Escalation | 81 | Near
Escalation | 6 | Very Near
而且
Metric| Tickets |Band
___________________________________
Fixed | 34 | New
Fixed | 52 | Within
Fixed | 36 | Near
Fixed | 4 | Very Near
現在,我想將它們以某種方式結合在一起有一個輸出這樣
Metric | New | Within | Near | Very Near
_____________________________________________________
Acknowledgement | 45 | 23 | 16 | 2
Escalation | 10 | 43 | 81 | 6
Fixed | 34 | 52 | 36 | 4
如何我可以在MS SQLServer中實現這一點,請求se?
爲什麼你不只是有一個表中的所有12個條目? – Codeman
這個問題和答案會給你很多信息 - 有幫助嗎? http://stackoverflow.com/questions/24470/sql-server-pivot-examples –
@ Pheonixblade9 - 這類問題通常是毫無意義的......通常當一個人問這樣的問題時,模式已經定義,並且沒有什麼可以改變它。 –