I need to check if a value lies in a range, however I can’t guarantee that either end of the range isn’t NULL. The values in this case are integers. ‘mo‘ represents employment
currently I have the following
WHERE (r.year BETWEEN mo.startyear AND mo.endyear >= r.year)
OR (mo.startyear <= r.year AND mo.endyear IS null)
OR (mo.startyear IS null AND mo.endyear IS null)
OR (mo.startyear IS null AND mo.endyear >= r.year)
is this the only way to check the mo was ’employed’ at a particular year (r)
How about: