說,有一個扁平順序層表以特殊字符「+」表示層級SQL for MSACCESS如何實現字符分隔的數據層次結構?
hr_table
ID FIELD1 My irrelevant comments
----------------
1 ASSETS No pluses - it means level0 hierarchy
2 +ASSETS_01 Level1 hierarchy
3 ++345667654 Level2 hierarchy
4 ++563255512 Level2 hierarchy
5 ...
有沒有辦法使用SQL創建MSACCESS場結構?我試圖結構最終數據如下:
final_data_table
ID LEVEL0 LEVEL1 LEVEL2 ...
-------------------------------------------
1 ASSETS ASSETS_01 345667654
2 ASSETS ASSETS_01 563255512
任何/所有幫助非常感謝!
可以有多少層次,並且總會有最多層次的行(即如果3層,總會有3行來填充你的表)?我知道你可以使用VBA在Access中處理,並且可以使用Excel重新格式化爲扁平行。 –
什麼標準決定那些Level2數字與ASSETS_01而不是ASSETS_02? – June7
需要檢查FIELD1成員以計算MAX出現的「+」。這將決定最高級別數量。但這是非常預先確定的。假設最高級別數爲5(作爲例子),它不會改變。 –