I am using MySQL 5.7.32-0 on ubuntu 18.04.1 and have noticied some strange behaviour with this query
SELECT *
FROM COMPLAINT
WHERE DATE(CREATED_DT) < STR_TO_DATE('2021-02-23','%Y-%m-%d')
and COALESCE(COMPLAINT_STATUS,'') NOT IN ('COM','CLS');
Here CREATED_DT is of DATETIME and COMPLAINT_STATUS is VARCHAR. Most of the time the result set returns 9 Rows but suddenly sometime 16 and 10. The results are checked in Workbench and phpmyadmin.
Update
After inspecting which condition is mibehaving i found that the condition and COALESCE(COMPLAINT_STATUS,'') NOT IN ('COM','CLS')
is the culprit but dont know whats wrong with it.
Update 2
I created new table and moved data to new table and deleted old and renamed new table now its working fine.