Further analysis suggests the problem was here:
WHERE ft.fdata = '20150701'
and was solved by:
WHERE (ft.fdata = CONVERT(DATETIME, '2015-07-01 00:00:00', 102))
And it might have been sufficient to use:
WHERE ft.fdata = '2015-07-01'
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)