Just a fairly general date filtering question...
I've got a date field that contains YYYYMMDD (no time). When looking for transactions in the current month I get a different result if I do...
and MyDateField between '2017-03-01' and '2017-03-31'
to if I do...
and Year(MyDateField) = '2017' and Month(MyDateField) = '3'
It looks like the 'between' method is excluding anything that happened on the 1st March (the other transactions are future dated).
Why is this?
These are the results from the 'between' method...
20170303
20170327
20170309
20170324
20170331
20170306
and these are the 'Year/Month' results...
20170303
20170327
20170309
20170324
20170301
20170331
20170306
20170301
The data is stored as an nvarchar(8) - should I be converting to date first?