select a.id, a.name, b.type, d.width 
from a
inner join b on a.id = b.id
right join c on b.type = c.type
inner join d on a.id = d.id 
and a.width = d.width 
and b.type=d.type 
and a.value is not null;