Buenos dias
me pueden ayudar realizando una consulta entre dos tablas
como con los siguientes datos
tabla 1
OWOR
Status
DocNum
ProdNameO
postdate
stardate
duedate
Tabla2
OITG
ItmsGrpNameOWOR
muchas gracias
Buenos dias
me pueden ayudar realizando una consulta entre dos tablas
como con los siguientes datos
tabla 1
OWOR
Status
DocNum
ProdNameO
postdate
stardate
duedate
Tabla2
OITG
ItmsGrpNameOWOR
muchas gracias
Buen día de forma directa no hay manera de unir esas tablas pero podrías intentar algo como esto:
SELECT
T0.“DocNum”,
T0.“Status”,
T0.“PostDate”,
T0.“StartDate”,
T0.“DueDate”,
T0.“ProdName”,
T0.“ItemCode”,
case
when T1.“QryGroup1”=‘Y’ then (select T0.“ItmsGrpNam” from OITG T0 where T0.“ItmsTypCod”=1)
when T1.“QryGroup2”=‘Y’ then (select T0.“ItmsGrpNam” from OITG T0 where T0.“ItmsTypCod”=2)
when T1.“QryGroup3”=‘Y’ then (select T0.“ItmsGrpNam” from OITG T0 where T0.“ItmsTypCod”=3)
when T1.“QryGroup4”=‘Y’ then (select T0.“ItmsGrpNam” from OITG T0 where T0.“ItmsTypCod”=4)
when T1.“QryGroup5”=‘Y’ then (select T0.“ItmsGrpNam” from OITG T0 where T0.“ItmsTypCod”=5)
when T1.“QryGroup6”=‘Y’ then (select T0.“ItmsGrpNam” from OITG T0 where T0.“ItmsTypCod”=6)
when T1.“QryGroup7”=‘Y’ then (select T0.“ItmsGrpNam” from OITG T0 where T0.“ItmsTypCod”=7)
…
end as “ItemsGrpNam”
FROM OWOR T0
INNER JOIN OITM T1 ON T1.“ItemCode”=T0.“ItemCode”
Tendrías que adecuar la consulta si es que los artículos tienen mas de una propiedad
Saludos.