我想在 sql db 中创建以下层次结构。这就是我所拥有的。它是正确的还是有更简单的方法。另外我如何查询它以显示相同的层次结构?
Services
Property
Residential
To let
Purchase
Accommodation
Maintenance
Plumbers
Electricians
Carpenters
Industrial
To let
Purchase
Accommodation
Maintenance
Plumbers
Electricians
Carpenters
桌子CategoryType
CategoryTypeID CategoryName
1 Services
2 Products
3 Main
4 MainSub
5 Sub
6 Sub1
桌子Category
CateogryID CategoryName CategoryTypeID ParentID
1 Property Service
2 Residential Main 1
3 To let MainSub 2
4 Purchase Sub 3
5 Accommodation Sub 4