SELECT t1.id,t1.name,t1.type AS type1,t2.type AS type2,t3.type AS type3 FROM table1 t1 LEFT JOIN table1 t2 ON t1.id=t2.id LEFT JOIN table1 t3 ON t1.id=t2.id
UNION
SELECT t1.id,t1.name,t1.type AS type1,t2.type AS type2,t3.type AS type3 FROM table1 t3 LEFT JOIN table1 t1 ON t1.id=t2.id LEFT JOIN table1 t2 ON t1.id=t2.id
UNION
SELECT t1.id,t1.name,t1.type AS type1,t2.type AS type2,t3.type AS type3 FROM table1 t2 LEFT JOIN table1 t3 ON t1.id=t2.id LEFT JOIN table1 t1 ON t1.id=t2.id