문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top