codice:
select c.nome,c.cognome,
max(case when tipo = 1 then 'x' else '' end) as radio,
max(case when tipo = 2 then 'x' else '' end) as tv,
max(case when tipo = 3 then 'x' else '' end) as internet,
max(case when tipo = 4 then 'x' else '' end) as stampa
from contatti_tipo as ct
left join contatti as c
on ct.contatto = c.id
group by contatto