Selecting only fields from a row that are not blank

I have a database table where up to 50% of the fields in any row may be blank or NULL. The blank fields vary from row to row. The contents of the fields are strings. I want to obtain a PHP array containing the strings from a row.

I could, I suppose, create the array from all the fields and then weed out the blanks, but I wonder if there’s a way in MySQL to SELECT only those fields with content. I can’t name the fields in the query because I don’t know in advance which row will selected and so don’t know which fields won’t be blank.

yes :slight_smile:

no :slight_smile:

Thank you, Rudy. I’ve spent the minutes since I posted my thread working out how to extract the non-blank fields with PHP, and it works a treat.

glad to help :cool: