RE: [coldbox:11106] Anyone good at MS SQL queries?

Think of a CTE as an ad-hoc view. Basically everything in the CTE is the same as creating a view with that SQL and then using it later in a select. It can be a bit cleaner than a sub-select and it allows for recursion which is pretty cool. (A CTE can select from itself)


Is this a new 2008 feature or will it work on 2005?

And yeah it does look a hell of a lot cleaner, not to mention easier to understand as well.