Bonjour,
Je suis bloqué sur une requete que j'arrive pas à optimiser ou la faire autrement.
Je voulais savoir si je peux afficher plusieurs colonnes à la suite d'un then :
Code:
1
2
3
4
5
6 CASE WHEN CONDITION THEN SELECT VAL1... AS SELECT VAL2... AS ELSE SELECT VAL3 ... AS END
Voici ma requete, (Je teste toujours la meme condition au départ )
Code:(SELECT CODE FROM VOL WHERE DEPART = 1)
... j'en ai dix comme ça :(Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 ,CASE When (SELECT CODE FROM VOL WHERE DEPART = 1)='NCE' then TRIM(SELECT VALISE_DSC FROM VOL WHERE DEPART = 1) else TRIM(SELECT VALISE_MNT FROM VOL WHERE DEPART = 1) end as ESCALE ,CASE When (SELECT CODE FROM VOL WHERE DEPART = 1)='NCE' then TRIM(SELECT POIDS_DSC FROM VOL WHERE DEPART = 1) else TRIM(SELECT POIDS_MNT FROM VOL WHERE DEPART = 1) end as POIDS ,CASE When (SELECT CODE FROM VOL WHERE DEPART = 1)='NCE' then TRIM((SELECT VALISE_DSC FROM VOL WHERE DEPART = 2) else TRIM(SELECT VALISE_MNT FROM VOL WHERE DEPART = 2) end as ESCALE1 ,CASE When (SELECT CODE FROM VOL WHERE DEPART = 1)='NCE' then TRIM(SELECT POIDS_DSC FROM VOL WHERE DEPART = 2) else TRIM(SELECT POIDS_MNT FROM VOL WHERE DEPART = 2) end as POIDS1
Par avance Merci pour votre aide