The result sets in these two figures are inconsistent and do not match expectations. I verified the results in a MySQL 8 environment, and they were consistent. Is this a version bug?
The ifnull function seems to be a major source of bugs. Adding the affects-6.5 label can find quite a few.
I hope your issue is the bug below:
According to the merge records, this bug should have been fixed in version 6.5.3.
You can try upgrading to 6.5.3 and see if it works. If it still doesn’t work, there are still 3 open issues with the ifnull function labeled affects-6.5 that haven’t been fixed yet.
You’ll just have to wait.
Personally, I think it’s an issue with the SQL writing. The filtering conditions for the master and slave tables are written chaotically. The conditions for the master table are written after the WHERE clause, while the conditions for the slave table are directly written in the JOIN ON clause.