on 05-17-2010 10:22 AM
Hi All,
i want a list of all item which are not delivered from last 15 days.
or which are not sold from last 15 days.
Thanks & Regards
Shiv
Hi Shiv,
If you have many items, the list wold be very long. If not, here is the query for the first requirement:
SELECT Distinct T0.ItemCode, T0.ItemName
FROM dbo.OITM T0
WHERE T0.ItemCode Not IN (SELECT Distinct T1.ItemCode FROM DLN1 T1 INNER JOIN ODLN T2 ON T2.DocEntry = T1.DocENtry WHERE DateDiff(DD,T2.DocDate,GetDate()) <16) AND T0.SellItem
= 'Y'
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may need more than one query to get them all. Here is something more:
SELECT Max(T1.DocNum) 'Delivery#', Max(T1.DocDate) 'Last Delivery Date', T0.ItemCode, MAX(T0.Dscription) 'Item Description', T0.Quantity
FROM dbo.DLN1 T0
INNER JOIN dbo.ODLN T1 ON T0.DocEntry = T1.DocENtry
WHERE DateDiff(DD,T1.DocDate,GetDate()) >15 and T1.DocDate > '[%0\]'
Group By T0.ItemCode, T0.Quantity
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.