Basically, I am doing something like this:
select a.name from schedule as a
where date(now()) <= a.dateTo;
But a.dateTo can be null. So, I would like a query to do something like this:
select a.name from schedule as a
where date(now()) <= a.dateTo IF a.dateTo is not null;
That’s just a simplified way to explain what I am trying to achieve.
Any ideas?
UPDATE:
The following example might give a better idea of what is required
select a.name from schedule as a
where date(now()) >= a.dateFrom and
date(now()) <= a.dateTo;
If I add the OR a.dateTo is null, I think it will override the first condition: date(now()) >= a.dateFrom, which is not the desired query. Something similar would happen with the use of AND.
If a.dateTo is null, it will be > date(now()), so those records should be retrieved, if the first condition also applies: date(now()) >= a.dateFrom
Thanks for your help
1 Answer