bj_shenglong (12/5/2012)
There is a particular problem, let's' say, we just want to find out who sold more then 2 each month in at least two consecutive months and when.For the above sample, below recursion would work. Also, recursion will stop immediately when it reaches the first qualified date.
Although they can be fast, recursive CTEs are still procedural in nature. The only way to know for sure is to do a test.
{Edit} Was distracted by a code promotion going on at work and I see that MickyT made just such a test. Thank you, good Sir!
--Jeff Moden
Change is inevitable... Change for the better is not.