SELECT 
id,
g1,
if(g2 is null,cast(id as CHAR),g2) as g2, 
g3a, g3b,
g4a, g4b, g4c,
g5a, g5b,
concat_ws('|', if (g6a=1,1,null), if(g6b=1,2,null), if(g6c=1,3,null)) as g6ac,
concat_ws('|', if (g7a=1,1,null), if(g7b=1,2,null), if(g7c=1,3,null)) as g7ac,
concat_ws('|', if (g8a=1,1,null), if(g8b=1,2,null)) as g8ab,
g8c, g8d, g8e,
g9a, g9b, g9c, g9d,
g10, g10a, g10b, g10c, g10d, g10e, g10f, g10g, if(g10h='NULL',null,g10h) as g10h, 
g11, g12, g13, g14, g15, g16, g17, g18, g19, g20, g21, g22
FROM genomos_general g order by id
