IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Date query with 15 days behind


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
AJAYREDDY

New User


Joined: 17 Feb 2007
Posts: 52
Location: USA

PostPosted: Tue Sep 22, 2015 1:17 am
Reply with quote

I need data from a DB2 table from given date back to 10 days.

For example if I give date as 09/18/2015 - 10 days I need only all the records from 10 days behind 09/18/2015.

I am trying this query but its failing. I seen examples for CURRENT DATE - 10 days but not for ANY GIVEN DATE - 10 days. Can someone please let me know the query.

SELECT * FROM QUAL.MYTABLE WHERE DATE_COL >= '09/18/2015' - 10 DAYS;
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Tue Sep 22, 2015 2:52 am
Reply with quote

Use DATE function. Try this:

Code:
SELECT * FROM QUAL.MYTABLE WHERE DATE_COL >= DATE('09/18/2015') - 10 DAYS;


.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts RC query -Time column CA Products 3
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top