EN
Hi,
I privation to bash a query that volition get each the items connected a warehouse and volition amusement the serial fig if it exists and besides the supplier, day erstwhile it was bought, terms of the point and DocNum. The contented is that though I person the query that shows the items connected the warehouse with the serial fig I don't cognize however to subordinate this to the different tables to spot the supplier information.
ES
Hola,
Quiero realizar una consulta que obtenga todos los artículos de un almacén y muestre el número de serie si existe, además del proveedor, la fecha de compra, el precio del artículo y el número de documento. El problema es que, aunque tengo la consulta que muestra los artículos del almacén con el número de serie, nary sé cómo relacionarlo con las otras tablas para ver la información del proveedor.
For present I person the pursuing query:
SELECT T2."ItemCode", T2."ItemName", T1."WhsCode", T1."WhsName", IFNULL((SELECT (SUM(Y."InQty") - SUM(Y."OutQty")) FROM OINM Y WHERE Y."ItemCode" = T2."ItemCode" AND Y."Warehouse" = T1."WhsCode"), 0) AS "Stock", IFNULL((SELECT (SUM(Y."TransValue")) FROM OINM Y WHERE Y."ItemCode" = T2."ItemCode" AND Y."Warehouse" = T1."WhsCode"), 0) AS "Costo Total", T3."ItmsGrpNam", T2."LastPurPrc" AS "UltimoPrecioCompra", T0."AvgPrice" AS "PrecioPromedio", O0."DistNumber" AS "SerialNumber" FROM OITM T2 INNER JOIN OITW T0 ON T0."ItemCode" = T2."ItemCode" INNER JOIN OWHS T1 ON T1."WhsCode" = T0."WhsCode" INNER JOIN OITB T3 ON T2."ItmsGrpCod" = T3."ItmsGrpCod" LEFT JOIN OSRN O0 ON O0."ItemCode" = T2."ItemCode" AND EXISTS (SELECT 1 FROM OSRQ O2 WHERE O2."ItemCode" = O0."ItemCode" AND O2."SysNumber" = O0."SysNumber" AND O2."WhsCode" = '[%0]') WHERE (SELECT (SUM(Y."InQty") - SUM(Y."OutQty")) FROM OINM Y WHERE Y."ItemCode" = T2."ItemCode" AND Y."Warehouse" = T1."WhsCode") != 0 AND T0."WhsCode" = '[%0]' ORDER BY T2."ItemCode", T1."WhsCode";