mysql - Sql query- Get results between two different date columns with its exact days match -
i have following 2 columns in 'deals' table. - subscribed_date - expired_date
i want sql query filter records 2 columns difference 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 above example, result should id=2 because difference 7 days.
is possible through sql query without iterations?
thanks in advance help!
why not select * deals datediff(expired_date, subscribed_date) = 7
?
further info here.
Comments
Post a Comment