MYSQL group_concat() function by default ignore null columns but it didn't ignore empty string columns. I have a field which is mediumtext type and not null. When I am using group_concat function on that the query generated unwanted ',,,' this type of value. How can i avoid this? Thanks in advance for your valuable time.
Transfer empty string to null:
NULLIF(column1,'')
Use GROUP_CONCAT
with IF(expr1,expr2,expr3)
, assume that you want concat column1
:
GROUP_CONCAT(IF(column1='', null, column1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With