The "NM" stands for "Never Mind". I had posted a rebuttal saying that the code didn't sort alphabetically, which seemed logical to me at the time. Then I realized that it did sort by the given ID using the same sort method that I had in my first article on hierarchies, compared it to the order the OP was looking for, and realized my mistake. I removed my mistaken post and, since we can't delete posts, just put in a quick "NM".
Still, it is a nice method... especially since I've used the same method in the past. 🙂
--Jeff Moden
Change is inevitable... Change for the better is not.