Relations and IS NOT NULL

Hello,

I’d need to create a relation which tests a date field on the to table to see both:

  1. if the field is not null and,
  2. if not null, whether it is greater than the from table related field

Now I can’t seem to find any suitable method to do this directly using relations. Is it even possible? What I basically need is to translate a query like

SELECT table2.* FROM table1 INNER JOIN table2 ON table1.pk = table2.pk WHERE table2.date_field IS NOT NULL AND table2.date_field > table1.date_field

Thanks in advance.

why do you need the extra IS NOT NULL for the table2.date field?

because in the second part

table2.date_field > table1.date_field

that will not give result back anyway if table2.date_field is null…

You’re right, I was reasoning from a programming perspective rather than a database one :D