SQL Server 的階層式與遞迴查詢
Jasmin Ludolf
Content Developer

零組件層級:

建立階層的要素:
PartID 與 SubPartID描述特性的要素:
Component:EngineTitle:V6BiTurboVendor:BMWProductKey:EV3891ASFCost:3000Quantity:1
+-----------------+---------------------------+
| Component | Level |
|-----------------|---------------------------|
| SUV | 1 |
|-----------------|---------------------------|
| Body | 2 |
|-----------------|---------------------------|
| Hood | 3 |
+-----------------+---------------------------+
+-----------------+---------------------------+
| Component | Quantity |
|-----------------|---------------------------|
| SUV | 1 |
|-----------------|---------------------------|
| Body | 1 |
|-----------------|---------------------------|
| Wheels | 4 |
+-----------------+---------------------------+
SQL Server 的階層式與遞迴查詢