It's a great thing that you found an answer that will perform correctly and will be fast and simple to understand and an answer that will help you to learn more about different techniques.
I'm sure there are many possible variations to obtain what you need and that's the greatest thing about SQL.:-D