I have the following 2 columns in 'deals' table. - subscribed_date - expired_date
I want the SQL query that to filter the records with 2 columns difference as follows
(expired_date - subscribed_date) == 7 days
For eg:
id | subscribed_date | expired_date
1 | 2015-07-04 04:13:29 | 2015-09-03 04:13:29
2 | 2015-06-03 04:13:29 | 2015-06-10 04:13:29
3 | 2015-01-05 04:13:29 | 2015-02-08 04:13:29
In the above example, the result should be id=2 because its difference is 7 days.
Is it possible through SQL query without iterations?
Thanks in advance for your help!