By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Compare Two Dates on 30 days greater than the other

P: 1
Trying to write a sql statement to return a result set comparing two dates where the 1st date is 31 days or greater than the 2nd date
Jul 31 '15 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,033
Maybe this will help:
Expand|Select|Wrap|Line Numbers
  1. SELECT
  2.    DATE('2015-08-01'),
  3.    ADDDATE(DATE('2015-08-01'), INTERVAL -1 DAY),
  4.    DATEDIFF('2015-08-01','2015-01-01');
  5.  
This should return 3 column with the values:
2015-08-01; 2015-07-31; 212

(my date-format is 'YYYY-MM-DD')
Aug 1 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.