Mahesh Mahesh.G Mahesh Mahesh.G - 1 month ago 10
MySQL Question

Mysql query, i had write a IFNULL condition ,but its showing empty space instead of Not Available (im using phpmyadmin 4.0 )

select IFNULL(idtag,'Not Available') parentidtag from authorisation;


Mysql query where the idtag default value is null, so i had write a condition ifnull is to show as 'not available' ,but it is showing as ' 'empty spaces in table(im using phpmyadmin 4.0 )

Answer

My guess is that the data in question is not really NULL, but rather is empty string ''. Instead, try the following query:

SELECT CASE WHEN IFNULL(idtag, '') = '' THEN 'Not Available' ELSE idtag END
FROM authorisation