Past 12 month rolling query

edited 2:41AM in FastReport 4.0
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

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:41AM
    assuming your query is internal to the report
    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.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.