Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Date Additions

I have a Command Query where i select fields between a data range from the table. The query looks like

SELECT field1, field2

FROM Table 1

Where Date Field between {?arg_start_date} and {?arg_stop_date}

I basically wanted to query date range between ARG_STOP_DATE + 1 ( Extra Day)

When i use the following it does not work. Is there a date add function where i can use.

SELECT field1, field2

FROM Table 1

Where Date Field between {?arg_start_date} and {?arg_stop_date} + 1

Former Member
replied

Hi Srinivasa,

Each database provider uses different implementation of SQL, so when writting an SQL Query, the best place to find information on the syntax you need to use will be in your sepecifc database documentation or on online forums for the specific database you are having question on.

Once the SQL Query works outside of Crystal Reports, then it will return the expect data in Crystal Reports when creating a report of a command object and using the SQL Query that you created.

Regarding adding a day to a date field, some database have the function "dateadd", but it might not be an available function in DB2. I looked on IBM Support Website, and one article recommend to use the following syntax to add a day:

DateField + 1 DAY  

So in your SQL Query it will look like:

SELECT field1, field2 
FROM Table 1
Where Date Field between {?arg_start_date} and ({?arg_stop_date} + 1 DAY)

Hope this help!

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question