probleme de concatenation (case)
Bonjour
Cela peu être intéresser quelqu'un.
Je n'arrivais pas à concaténer deux fonctions case
Code:
1 2 3 4 5 6 7 8 9
| select ilppa,case when basicat !='' then application||' ( '||basicat||' )'
else application||' ( '||id_appli||' )'
end as applis||case
when methode= 1 then '_TINA'
when methode= 2 then '_NBU'
when methode= 3 then '_MVS'
when methode= 4 then '_AVM'
end as appli from applis
order by 2; |
Resultat
Code:
ERROR: syntax error at or near "||" at character 129
la raison c'est l'alias dans la première fonction case
le script qui fonctionne
Code:
1 2 3 4 5 6 7 8 9
| select ilppa,case when basicat !='' then application||' ( '||basicat||' )'
else application||' ( '||id_appli||' )'
end||case
when methode= 1 then '_TINA'
when methode= 2 then '_NBU'
when methode= 3 then '_MVS'
when methode= 4 then '_AVM'
end as appli from applis
order by 2; |
Si quelqu'un avait une autre façon de faire je suis preneur.