cancel
Showing results for 
Search instead for 
Did you mean: 

How to query the average shelf time of sold goods

peter_le_grand
Explorer
0 Kudos

Based on invoices, I want to know how long the products have been in inventory before sold. Any SQL suggestions for this?

Accepted Solutions (0)

Answers (1)

Answers (1)

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try this query,

SELECT T0.[ItemCode], T0.[Dscription], max(T0.[DocDate]) as 'Last Received Date' FROM OINM T0 WHERE T0.[OutQty] <= 0 GROUP BY T0.[ItemCode], T0.[Dscription] ORDER BY max(T0.[DocDate]) desc

Regards,

Nagarajan