我有一个分层数据表,我试图将其选择为单个分组的 XML 值:
列:Id, Type, SubType, SubSubType
样本数据:
Id Type Subtype SubSubType
1 Product Documentation Brochures Functional Brochures
2 Product Documentation Brochures Fliers
3 Product Documentation Data Sheets and Catalogs Data Sheets
4 Product Documentation Data Sheets and Catalogs Catalogs
5 Other Documentation Other classification User Guides
对于以上数据,我想输出如下xml:
<AllTypes>
<Type name="Product Documentation">
<SubType name="Brochures">
<SubSubType name="Functional Brochures"/>
<SubSubType name="Fliers"/>
</SubType>
<SubType name="Data Sheets and Catalogs">
<SubSubType name="Data Sheets"/>
<SubSubType name="Catalogs"/>
</SubType>
</Type>
<Type name="Other Documentation">
<SubType name="Other classification">
<SubSubType name="User Guides"/>
</SubType>
</Type>
</AllTypes>
即包含上表中所有行的单个xml 结构,按第一列(类型)分组,并按第二列(子类型)进一步分组。