Question

I need a clause in my query to bring back data when an event happened within 45 days of another event. An example:

WHERE D1.Date  Is within 45 days after   D2.date

I am currently using this but I don't think it's getting me what I want:

AND ABS (D1.Date - D2.date) >= 45

EDIT:

Thank you for your answer, I've amended it slightly to my needs:

AND D1.Date BETWEEN D2.date AND d2.date +45

Was it helpful?

Solution

... WHERE D1.date BETWEEN D2.date AND date_add(D2.date,INTERVAL 45 DAY);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top