>Thank you for the example.
You're welcome. If you want to learn about CTE (common table expressions), take a look at my blog post
CTE and hierarchical queriesIt contains links to several other good blogs on the topic of CTE.
If it's not broken, fix it until it is.
My Blog