I have a DB2 DATE type field in a DB2 table. I want to select data by a date filter. For example:
SELECT *
FROM table
WHERE registrationdate > '2002-10-01';
From the above query, I get records with registrationdate starting from '1943-10-01', but this is incorrect.
These do not work either:
registrationdate > date('2002-10-01')
date(registrationdate) > date('2002-10-01')
date(registrationdate) > '2002-10-01'
How do I need to compare dates?
The SQL standard format for a DATE literal is:
DATE '2002-10-01'
At the very least, it is worth trying:
SELECT *
FROM table
WHERE registrationdate > DATE '2002-10-01';