cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Previous Month from Time Period under DateRange in a SQL query

Former Member
0 Kudos

I wan to select Previous Month from TimePeriod under daterange tab in SQL query and want to see the previous month data.

But i dont want to select date range.

Without selecting date range is it posible?

Please suggeat me how to do.

Your help will be highly appreciated.

Regards,

Manisha

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

Since PreviousMonth is a time period, it will override any specific start / end dates you have chosen, as well as the Duration / DurationUnits.

In order for your SQL Query to use the dates that will be determined by the server, you will need to have either used the DateColumn in Query mode or used

[SD] and [ED]

in FixedQuery mode.

To see what dates they become just test your query template in XML format and observe the StartDate and EndDate attributes in the beginning Rowsets portion of the document.

Regards,

Jeremy

Edited by: Jeremy Good on Feb 23, 2008 9:43 AM

Edited by: Jeremy Good on Feb 23, 2008 9:44 AM

Answers (2)

Answers (2)

Former Member
0 Kudos

Sorry Manisha,

they not allowe me to use

[SD] | [ED]

in the normal message content. Jeremy explain you the same.

Regards.

Former Member
0 Kudos

Manisha,

you don't need to set up start and end date. You need only to select Time Period under the Tab Date Range

for PreviousMonth. Now you can insert your SQL statement like this

select * from tablename where startdate >= [SD] and startdate <= [ED]

[SD] will automatically changed by executing the query with the PreviousMonth startdate.

[ED] will automatically changed by executing the query with the PreviousMonth enddate.

Kind Regards

Pedro