diamondgm (10/1/2012)
I believe Jeff talks about this "triangular join" in the article I referenced.
I don't think that its a triangular join - no subquery really.
It looks like a moficifation of the CROSS JOIN method of running total computation.
Instead of a filtered CROSS JOIN, the INNER JOIN condition is expanded.
This is something that Jeff did not cover in his article as far as I can remember.
This is my understanding; I'm open to correction.
You're correct. It's not a "triagular join". It's worse. It's a full accidental cross join. Look at the execution plan. You have 5 rows of data but one of the arrows coming off the table has 25 rows. If you add one more row to the data, that arrow jumps to 36, as expected with a cross join.
--Jeff Moden
Change is inevitable... Change for the better is not.