Comparing DB2 dates

db2

Solution

I explored some other problems with database, after restart it started to work, so this works correctly now:

registrationdate > '2002-10-01'

Problem

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?

Original source