My query can be simplified as this:
SELECT a.id, a.name, b.* FROM a LEFT JOIN b ON a.id=b.id
Which b
is from group concat select (very dynamic column)
. Sometimes there are 3 columns in b
, sometimes 10 columns depend on filtering.
What I want is something like this:
SELECT a.id, a.name, IFNULL(b.*,0) FROM a LEFT JOIN b ON a.id=b.id
I already looked here and here and the answer is always repeating per column. But I can't apply ifnull
per column because I don't know what the columns are. Is there any other approach for replacing null values from left join?
All columns are of the integer type.