Past 12 month rolling query
Hi all,
I'm new to SQL and FR so I'm hoping this will be a simple one for someone to advise me on..
I currently have a query to give me the past 12 months results from a database. At the mo, it is a static 12 months which I specify.. I want it to be dynamic and give the past 12 months from the point of which the query is run..
Current code:
declare @startDate DATETIME
declare @endDate DATETIME
set @startDate = '2010-01-01 00:00:00'
set @endDate = '2010-12-01 00:00:00'
How can I do the past 12 months from the past complete month?
Thanks
I'm new to SQL and FR so I'm hoping this will be a simple one for someone to advise me on..
I currently have a query to give me the past 12 months results from a database. At the mo, it is a static 12 months which I specify.. I want it to be dynamic and give the past 12 months from the point of which the query is run..
Current code:
declare @startDate DATETIME
declare @endDate DATETIME
set @startDate = '2010-01-01 00:00:00'
set @endDate = '2010-12-01 00:00:00'
How can I do the past 12 months from the past complete month?
Thanks
Comments
parameterize your query use an fr dialog with 2 dateedits, 2 buttons and set the params of the sql to the dateedits.
if your query is external then you must create your own dialog outside of the report.