3:51 PM
@Vérace My biggest issues with them (except recursion where they must be used) is a derived table is already very clear and the statement is with the rest of the code - a CTE is really just a bad way of doing the same thing. Worse, CTEs can instill a sort of lazy, step-wise approach to writing queries.
End of the day it's preference, except when they (or a derived table) would be superfluous. I see a lot of superfluous CTEs.
Also, in Teradata there's this bug where you have to write them last to first which is super annoying.