那我請問一下.我自己研究要將四張表做數據透視表.結果語法出現問題.請幫我看看.另外是如果要很多張表該怎麼寫
select [期初明細$].廠別,[期初明細$].倉別,[期初明細$].品名,[期初明細$].物料編碼,[期初明細$].單位,[期初明細$].帳面 as 期初帳面,[期初明細$].庫存 as 期初庫存,[期初明細$].差異 as 期初差異,0 as 入庫帳面,0 as 入庫庫存,0 as 入庫差異,0 as 出庫帳面,0 as 出庫庫存,0 as 出庫差異,0 as 補料帳面,0 as 補料庫存,0 as 補料差異 from [期初明細$] union all select [入庫明細$].廠別,[入庫明細$].倉別,[入庫明細$].品名,[入庫明細$].物料編碼,[入庫明細$].單位,0 as 期初帳面,0 as 期初庫存,0 as 期初差異,0 as 出庫帳面,0 as 出庫庫存,0 as 出庫差異,[入庫明細$].帳面,[入庫明細$].庫存,[入庫明細$].差異,0 as 補料帳面,0 as 補料庫存,0 as 補料差異 from [入庫明細$] union all select [出庫明細$].廠別,[出庫明細$].倉別,[出庫明細$].品名,[出庫明細$].物料編碼,[出庫明細$].單位,0 as 期初帳面,0 as 期初庫存,0 期初差異,0 as 入庫帳面,0 as 入庫庫存,0 as 入庫差異,[出庫明細$].帳面,[出庫明細$].庫存,[出庫明細$].差異,0 as 補料帳面,0 as 補料庫存,0 as 補料差異 from [出庫明細$] union all select [補料明細$].廠別,[補料明細$].倉別,[補料明細$].品名,[補料明細$].物料編碼,[補料明細$].單位,0 as 期初帳面,0 as 期初庫存,0 as 期初差異,0 as 入庫帳面,0 as 入庫庫存,0 as 入庫差異,0 as 出庫帳面,0 as 出庫庫存,0 出庫差異,[補料明細$].帳面,[補料明細$].庫存,[補料明細$].差異 from [補料明細$] |