I find they are easier to maintain than doing the same thing with a lot of derived tables or 20 joins and I find that I can be more assured that it returns the correct data with no effect of multiple records due to the one-many relationships in all the different joins. I use a series of CTEs to get chunks of the data I need and then combine in the final select. One place besides recursion where I find CTEs incredibly useful is when creating complex reporting queries.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |