Hi guys. Running an SQL query through Query Generator in SBO, and I've come across something weird. I won't print the whole SQL query right now, but you can rest assured that both are completely identical, except for one conditional.
If I use a condition (MONTH(T1.DocDate) = MONTH(GETDATE())-1) i.e. return documents where the posting date is last month, my query returns 500+ results.
If I swap that condition with (T1.DocDate >= CONVERT(DATETIME, '20090501', 112) ) AND (T1.DocDate <= CONVERT(DATETIME, '20090531', 112) ) i.e. where the posting date is between the 1st and 31st of May, my query returns only 260 results.
For some reason, the second condition is excluding more results. Any general ideas on why? None of the records that are excluded fail the condition. They're all dated in May.
Anyway, this is non-critical. If we can't figure it out, I may throw up the full query.
Thanks again for any help.
James.