Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Date query with 15 days behind

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
AJAYREDDY

New User


Joined: 17 Feb 2007
Posts: 47
Location: USA

PostPosted: Tue Sep 22, 2015 1:17 am    Post subject: Date query with 15 days behind
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: 336
Location: USA

PostPosted: Tue Sep 22, 2015 2:52 am    Post subject: Reply to: Date query with 15 days behind
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm
No new posts GETMAIN/FREEMAIN query Suja.Sai CICS 9 Tue Jan 31, 2017 12:01 pm
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us