Ho una tabella di dati gerarchici che sto cercando di selezionare come un singolo, il valore XML raggruppati:SQL Server: a due livelli GROUP BY con output XML
Colonne: dati Id, Type, SubType, SubSubType
Esempio:
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
per i dati di cui sopra, desidero uscita seguente 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>
cioè una singola struttura xml contenente tutte le righe dalla tabella precedente, raggruppate per la prima colonna (Tipo) e ulteriormente raggruppate dalla seconda colonna (Sottotipo).
Benvenuti a 'stackoverflow'. Ben descritto !. Si prega di condividere il codice di esempio che avete provato fino ad ora in modo che altri utenti possano aiutarvi facilmente. –