MySQL IFNULL "N / A" gives "item cannot be found in collection" Error
I am using IFNULL functions to convert NULL values to zeros in my SQL queries, for example:
SELECT IFNULL(mem.comment_count,0) FROM members...
This works great. Now I am trying to use the IFNULL function to convert NULL values to string "N / A", but I keep getting the error: "The item could not be found in the collection matching the requested name or order":
SELECT IFNULL(mem.address2,'N/A') FROM members...
I've even tried using COALESCE just to expose an empty string instead of NULL:
SELECT COALESCE(NULLIF(mem.address2, ''), 'N/A') FROM members...
But it still throws the same error.
Any ideas?
+3
source to share