Katerine459 (3/19/2015)
GilaMonster (3/19/2015)
Katerine459 (3/18/2015)
Unless the CTE is also a correlated subquery, wouldn't it just run onceAnd who said that a correlated subquery doesn't run just once?
I read that here: http://www.sqlservercentral.com/articles/Stairway+Series/105972/
This statement is wrong (and trivially provable to be wrong)
It will be run once for each candidate row selected in the outer query.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability