• Ok, know what was wrong with executing but data is also not proper :doze:

    I put some PRINT commands, look at this

    WeeksOnStart

    20150406,20150401

    val_in_cursor

    2015-04-06

    Warning: Null value is eliminated by an aggregate or other SET operation.

    (1288 row(s) affected)

    val_in_cursor

    2015-04-01

    Warning: Null value is eliminated by an aggregate or other SET operation.

    (1253 row(s) affected)

    WeeksOnEnd

    20150406,20150401

    (0 row(s) affected)

    When i cut off one join to date to make ending select not filtering on these dates Im getting duplicated data like whis

    20150401 36 78976

    20150406 36 78976

    20150401 37 34562

    20150406 37 34562

    20150401 38 37655

    20150406 38 37655