We have a MySQL DB that is consolidated from two other MySQL DB's. This consolidation takes place every morning at about 5am.
When the consolidation task fails, I can see it easily enough with:
select * from progress_log where stoptime = curdate()
Which returns:
oid | starttime | stoptime | Comment
NULL NULL NULL NULL
However i want to return the following when there is no curdate() to allow me to schedule an automated report that is emailed only when there is data:
stoptime |
Sync failed
Trying the below appears to return a blank (not null) value.
select ifnull(stoptime, 'Sync Failed') as 'Bla' where stoptime = curdate(
What am i doing wrong? I have tried various methods (coalesce, case, if(stoptime is null...)).
Thanks in advance,
Mike