Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Query para costos maximo y costos minimo por rango de fechas

Buenos Dias gente,

realice el siguiente query para saber los costos maximos y costos minimo de mis productos por rango de fecha, pero no me da datos reales

si me podria ayudar se los agradeceria

SELECT DISTINCT T0.[ItemCode], T0.[Dscription],

(select Max (PDN1.StockSum/PDN1.Quantity) from  PDN1 WHERE PDN1.Itemcode=T0.ItemCode) AS 'Maximo',

(select Min (PDN1.StockSum/PDN1.Quantity)  from  PDN1 WHERE PDN1.Itemcode=T0.ItemCode) AS 'Minimo'

FROM PDN1 T0  INNER JOIN OPDN T1 ON T0.DocEntry = T1.DocEntry

WHERE T1.[DocDate] BETWEEN '[%0]' AND '[%1]'and t1.DocType='I'

Former Member
Former Member replied

Hola Cristiano.

prueba la siguiente Query, o adaptala según tu necesidad

SELECT

T0.ItemCode,

T0.Dscription,

MAX(T0.StockSum/NULLIF(T0.Quantity,0)) 'MAX',

MIN(T0.StockSum/NULLIF(T0.Quantity,0)) 'MIN'

FROM  PDN1 T0  INNER JOIN OPDN T1 ON T0.DocEntry = T1.DocEntry

GROUP BY

T0.ItemCode,

T0.Dscription

Saludos

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question