Problème entre order by et Union
Bonjour,
Je souhaite récupérer des données via une union dont la 2ème partie est triée.
Seulement Oracle me dit 'ORA-00904: "U"."LIBELLELONG" : identificateur non valide'
Voici mon code
Code:
1 2 3 4 5 6 7 8 9 10 11
| select distinct u.* from affectation a, unitestruct u where agentuniqueid='000002'
and a.codeuf=u.code
and a.typeaff='P'
and sysdate between a.periodedatedebut and a.periodedatefin
and sysdate between u.datedebut and u.datefin
union
select distinct u.* from affectation a, unitestruct u where agentuniqueid='000002'
and a.codeuf=u.code
and a.typeaff='S'
and sysdate between a.periodedatedebut and a.periodedatefin
and sysdate between u.datedebut and u.datefin order by u.libellelong; |
En gros je veux ma ligne pour typeaff à P en premier puis le reste (sur 'S') trié par libellé