Try this:
SELECT CERT_DATE "Date Of Last Cert Test",
ADD_MONTHS(CERT_DATE, 6) "Date Due"
FROM TESTING.CERTS
WHERE MONTHS_BETWEEN(CURRENT_DATE, CERT_DATE) <= 3
Question
I am trying to check when a persons certification is due within the next 3 months. I want this to be able to execute correctly no matter when it is executed. A person has to renew their certification every 6 months.
Here is my code so far:
SELECT CERT_DATE "Date Of Last Cert Test",
add_months(CERT_DATE, 6)"Date Due"
FROM TESTING.CERTS
;
La solution
Try this:
SELECT CERT_DATE "Date Of Last Cert Test",
ADD_MONTHS(CERT_DATE, 6) "Date Due"
FROM TESTING.CERTS
WHERE MONTHS_BETWEEN(CURRENT_DATE, CERT_DATE) <= 3
Autres conseils
SELECT CERT_DATE [DateOfLastCertTest],
DATEADD(MONTH, 6, CERT_DATE) [DateDue]
FROM TESTING.CERTS