I'm very new to Oracle. I have this problem, I got 365 days difference while these 2 dates' difference is are only one day.
This is my SYSDATE Query Output:
SELECT to_date(SYSDATE,'yyyy-MM-dd') FROM LOGINRECORDS
15-OCT-11
This is my date from column Query Output:
SELECT to_date(LoginDate,'yyyy-mm-dd') FROM LOGINRECORDS WHERE LoginRecordId = '1000001'
15-OCT-10
And when I run this query :
SELECT (to_date(SYSDATE,'yyyy-MM-dd') - to_date(LoginDate,'yyyy-MM-dd')) difference FROM LOGINRECORDS WHERE LoginRecordId = '1000001'
I got this:
365
This is my table description :
CREATE TABLE LOGINRECORDS
(
LoginRecordId NUMBER GENERATED ALWAYS AS IDENTITY START WITH 1000000 INCREMENT BY 1,
LoginDate DATE,
patientUserId NUMBER
)
Hope you guys willing to help, Tq in advance.