Programming in mysql: MySQL string comparison without operator inconsistency on the same server? on newest questions tagged mysql – Stack Overflow
I found what is to me a really weird phenomenon. In my MySQL server which is version 5.0.92, I use a query as follows:
SELECT IF(thumb, thumb, image) AS thumb FROM blog WHERE id = 200;
Because I want to get the thumb value if it is not empty, otherwise the image value. Now in one database on this server, this works perfectly fine, just the way I want it to. But on another database on the exact same server,
thumb always evaluates to false, even it is not empty, and the value for
image is always selected.
I know that I can use
thumb != '' and that does work on both databases but please someone tell me how this happened? Is this some kind of database-specific setting?
Programming in mysql: programming-in-mysql