Bonjour à tous,
Je commence juste à travailler avec les CTE sous SQL Server, et je n'arrive pas à faire une requête sur 2 tables.
La requête suivante me retourne le message : The multi-part identifier "et.CodeEtape" could not be bound
Pouvez-vous me dire ce que je fais mal, je n'arrive pas à trouver...
Merci d'avance !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 WITH Route_CTE AS ( SELECT [CodeEtapeDestination],[LibelleEtape] FROM [dbo].[WU_Route] td, [dbo].[WU_Etape] et WHERE td.[CodeEtape]=2 and td.[DefaultRoute]=1 and td.[CodeType]='TYPE1' and td.[CodeEtapeDestination]=et.[CodeEtape] UNION ALL SELECT td.[CodeEtapeDestination], et.[LibelleEtape] from [dbo].[WU_Etape] et,[dbo].[WU_Route] td INNER JOIN Route_CTE rtce ON rtce.[CodeEtapeDestination]=td.[CodeEtape] and td.[DefaultRoute]=1 and td.[CodeType]='TYPE1' and td.[CodeEtapeDestination]=et.[CodeEtape] ) SELECT * FROM Route_CTE GO
Gaëlle.
Partager