문제

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
 ;
도움이 되었습니까?

해결책

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

다른 팁

SELECT CERT_DATE [DateOfLastCertTest], 
DATEADD(MONTH, 6, CERT_DATE) [DateDue]
FROM TESTING.CERTS
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top