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 DB2: Need helping below DB2 query DB2 13
No new posts Date conversation DFSORT/ICETOOL 6
No new posts To pull the file with Date and Time u... TSO/ISPF 17
No new posts Help this REXX Rookie-Bad arithmetic ... CLIST & REXX 7
No new posts Connect:Direct Add yesterday date in ... All Other Mainframe Topics 3
Search our Forums:

Back to Top