sql server - Identifying Consecutive Months -


i've been using answer posted in 2010 understand how use cte in order identify orders consecutive months in sql. i've got head wrapped around bulk of query don't understand last few lines , why choose dates did.

tsql finding order occurred in 3 consecutive months

where exists ( select 1 anchors o.custid = a.custid , o.orderdate >= dateadd(month, a.ind, '19991201') , o.orderdate < dateadd(month, a.ind, '20000301')

why did choose dates of 19991201 , 20000301?

thanks much. hope chance respond. understanding open whole new layer of understanding me.

michael

19991201 , 20000301 dates in format yyyymmdd , clause use month.

so, if needs 3 consecutive months dec/99, jan/2000 , feb/2000 clause wrote.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -