Probably the easiest way to do this is using xml path, but xml explicit gives you more flexibility, albeit allegedly harder to write, but allowing you to produce the xml exactly the way you specified. Here is some untested code using xml explicit.select 1 as Tag, null as Parent, BibleBookNumber as [BibleBookNumber!1!Number], null as [BibleChapter!2!Chapter], null as [BibleVerse!3!Verse], null as [BibleVerse!3]from YourTableunionselect 2 as Tag, 1 as Parent, BibleBookNumber, BibleChapter, null, nullfrom YourTableunionselect 3 as Tag, 2 as Parent, BibleBookNumber, BibleChapter, BibleVerse, BibleCitationfrom YourTableorder by [BibleBookNumber!1!Number], [BibleChapter!2!Chapter], [BibleVerse!3!Verse]for xml explicit