Can anybody help me with an SQL expression please ?
I'm writing custom reports using SQL, but am having a problem with defining time/date expressions.
I want to define a datetime covering "last month".
The builtin reports generate something like :-
WHERE
( DateTime BETWEEN 39171 AND 39200.9999884259 )
This is not very useful for hard coded SQL reports, so for September (last Month),
I manually created the following :-
WHERE
( DateTime BETWEEN DATEADD(month, 0, '09/01/2007') AND DATEADD(month, 0, '09/30/2007') )
This works fine but obviously needs changing every month
What I need is a generic expression which will match for the whole previous calender month automatically.
(I've seen some examples using datediff, etc, but have been unable to get them working within Orion)
Thanks,
Julian Fletcher