mysql - Group_concat distinct makes my query fails if the field is null -
select replace(group_concat(distinct(myvalue)),',','|') mytable myconditions
i'm using query multiple times in union. when myvalue different null, works. when has no value, query fails (it says query can't executed). tried if(myvalue null, '000', myvalue), doesn't work (same ifnull). think distinct doesn't work here, since query :
select distinct('000') mytable myconditions
doesn't work either.
how can manage error when myvalue null group_concat(distinct())?
thank you
try out this:
select replace(group_concat(distinct(coalesce(myvalue,'000'))),',','|') mytable myconditions
Comments
Post a Comment