SELECT T0.ItemCode, T0.OnHand, (从OSRI WHERE DATEDIFF(DAY,InDate,GETDATE())中选择COUNT(1)<45 AND Status = 0 AND ItemCode = T0 .ItemCode)AS'<45天(数量)', (从OSRI WHERE DATEDIFF(DAY,InDate,GETDATE())中选择COUNT(1)> = 45 AND DATEDIFF(DAY,InDate,GETDATE())< 90 AND Status ='0'AND ItemCode = T0.ItemCode)AS '45至90天(数量)', (从OSRI WHERE DATEDIFF(DAY,InDate,GETDATE())中选择COUNT(1)> = 90 AND DATEDIFF(DAY,InDate,GETDATE())<180 AND Status ='0'AND ItemCode = T0.ItemCode)AS '90至180 Days(Qty)', (从OSRI WHERE DATEDIFF中选择COUNT(1) (DAY,InDate,GETDATE())> = 180 AND Status ='0'AND ItemCode = T0.ItemCode)AS'> 180 Days(Qty)' FROM OITM T0 WHERE T0.OnHand> 0
嗨,
在"查询"下尝试执行此操作。 但这会让您老化基于序列的商品。
/序列号项目的库存帐龄报告//
SELECT
T0.ItemCode,
T0.OnHand,
(从OSRI WHERE DATEDIFF(DAY,InDate,GETDATE())中选择COUNT(1)<45 AND Status = 0 AND ItemCode = T0 .ItemCode)AS'<45天(数量)',
(从OSRI WHERE DATEDIFF(DAY,InDate,GETDATE())中选择COUNT(1)> = 45 AND DATEDIFF(DAY,InDate,GETDATE())< 90 AND Status ='0'AND ItemCode = T0.ItemCode)AS '45至90天(数量)',
(从OSRI WHERE DATEDIFF(DAY,InDate,GETDATE())中选择COUNT(1)> = 90 AND DATEDIFF(DAY,InDate,GETDATE())<180 AND Status ='0'AND ItemCode = T0.ItemCode)AS '90至180 Days(Qty)',
(从OSRI WHERE DATEDIFF中选择COUNT(1) (DAY,InDate,GETDATE())> = 180 AND Status ='0'AND ItemCode = T0.ItemCode)AS'> 180 Days(Qty)'
FROM
OITM T0
WHERE
T0.OnHand> 0
AND T0.ManSerNum ='Y'
一周热门 更多>