Bonjour,

J'ai récupéré une query sous excel par tatonnement j'ai réussi à collecter certaines informations.
Cependant j'ai besoin de lire une table y collecter un champ.
Puis de rappeler la même table avec une autre clé pour lire le même champ.

Je lit le champ string02 de la table Z_LOT_NO_CHARACTERISTIC avec la clé APR_Inventory.LotNo.
Je lis aussi la table Genealogy où j'obtient un champ Genealogy.ParentLotNo.

J'aimerais refaire un inner join comme suite

Code : Sélectionner tout - Visualiser dans une fenêtre à part
" INNER JOIN [flexnet].[dbo].[Z_LOT_NO_CHARACTERISTIC] ON Z_LOT_NO_CHARACTERISTIC.LotNo = genealogy.parentlotno " & _
Pour récupérer un nouvelle fois le champ String02 de Z_LOT_NO_CHARACTERISTIC avec la valeur genealogy.parentlono

Je me doute qu'il faille déclarer cette table en alias j'ai essayé avec une <*> devant et après, mais ça ne passe pas

Voici un extrait du code comme il se présente.
Il fonctionne jusqu'à ce niveau, mais je ne sais pas relire
Z_LOT_NO_CHARACTERISTIC.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
    'Set and Excecute SQL Command'
        Set objMyCmd.ActiveConnection = objMyConn
        objMyCmd.CommandText = "SELECT container.Container, Product.ProductNo, TT_Prod.Medium, string02, APR_Inventory.LotNo, Container.Warehouse, APR_Inventory.Location, TT_Comment.Extended, Genealogy.ParentLotNo" & _
        " FROM [MaBase].[dbo].[Inventory_Container]" & _
        " INNER JOIN [MaBase].[dbo].[Container] ON container.container = inventory_container.container" & _
        " INNER JOIN [MaBase].[dbo].[inventory] ON ID = Inventory_container.inventoryID " & _
        " INNER JOIN [MaBase].[dbo].[APR_Inventory] ON APR_Inventory.InventoryId = Inventory.ID  " & _
        " INNER JOIN [MaBase].[dbo].[LOT_NO] ON [MaBase].[dbo].[LOT_NO].[LotNo] = APR_Inventory.LotNo" & _
        " INNER JOIN [MaBase].[dbo].[Z_LOT_NO_CHARACTERISTIC] ON [MaBase].[dbo].[Z_LOT_NO_CHARACTERISTIC].[LotNo] = APR_Inventory.LotNo" & _
        " INNER JOIN [MaBase].[dbo].[PRODUCT] ON PRODUCT.ID = [MaBase].[dbo].[inventory].ProductID" & _
        " INNER JOIN [MaBase].[dbo].[TEXT_TRANSLATION] AS TT_Prod ON TT_Prod.TextID = PRODUCT.TextID AND TT_Prod.LanguageID = '1036'" & _
        " INNER JOIN [MaBase].[dbo].[TEXT_TRANSLATION] AS TT_Comment ON TT_Comment.TextID = LOT_NO.TextID AND TT_Comment.LanguageID = '1036'" & _
        " INNER JOIN [MaBase].[dbo].[Genealogy] ON genealogy.LotNo = inventory.lotno " & _
        " WHERE Container.Container like '" + Worksheets("ProtectedSheet").Cells(1, 1).Value + "%'"
Je ne sais pas si je suis sur le bon forum, je suis un habitué d'Excel, mais je pense que ma concerne plus SQL.
Merci de vos conseils
Denis