資料庫名稱: MS-SQL
資料庫版本: VBA
內容/問題描述: 想要讀右邊的樣子
Name Location Number Name 001 002 003
A 001 50 A 50 10 20
A 002 10 B 30 10 0
A 003 20 ==>
B 001 30
B 002 10
Select
Name,
Number=(Select i.Number From Table as i where i.Locate=001 and i.Name=j.Name),
Number=(Select i.Number From Table as i where i.Locate=002 and i.Name=j.Name),
Number=(Select i.Number From Table as i where i.Locate=004 and i.Name=j.Name)
From Table as j
上面這樣寫會得到錯誤"子查詢傳回不只1 個值"
請問要怎麼改呢?
謝謝