5, Not sure what am I doing wrong, please help. As it seems in a query on multiple column comparison to find least value, NULL continues to show up as a Resultant instead of least value
SELECT
IF(col1 IS NULL OR col2 IS NULL OR col3 IS NULL OR col4 IS NULL OR col5 IS NULL,
COALESCE(col1,col2,col3,col4,col5),
LEAST(col1,col2,col3,col4,col5)
) As Resultant
from db.tablename
Group by Id;
Alternatively tried CASE select without much success. Thanks
GROUP BY? You have no aggregates in there.colis not null ?IdthePRIMARY KEYof the table?