Ver originalSELECT cod,COALESCE(valor1a,valor2a,valor3a)valorFROM tabla1UNION ALLSELECT cod,COALESCE(valor1b,valor2b,valor3b)FROM tabla1