mysql - Optimal way to fill in missing values after a LEFT JOIN? -
i simplify problem make core issue clear: have query tablea inner join tableb left join tablec
.
the result of left join in result set, 2 of columns might have null values in rows. fill in missing values have loop on result set , query database has data (so not possible join in first place).
my question is: there standard/optimised approach when need fill nulls of result set after left join?
you can use coalesce(...)
(msdn - coalesce) instead.
you query like:
select a, b, coalesce(tableb.c, 'replacement value') tablea inner join tableb left join tablec ...
add join replacement table , put column want replace null
values in coalesce
function in don't want use static value.
Comments
Post a Comment