select distinct codigo_pago from tabla_con_diferentes_campos where estado_pago='PGCANU' or ( estado_pago='PGCACE' and ID_ESTADOPAGO=1 )