SQL Server : FOR XML sorting control by attribute
问题 I am generating a XML file from a SQL Server query. I have some problem about sorting elements issues. For example, there is simple code as below. <test> <tree abc="123"/> <tree abc="789"/> <tree-order abc="456"/> </test> As you can see tree and tree-order are different elements and I want to sort by attributes as <test> <tree abc="123"/> <tree-order abc="456"/> <tree abc="789"/> </test> like this. Anyone has good idea to solve this problem? Thank you. Sorry I have detail question as below AS