UPDATE ProdChanges
SET processingStatus='ERPPRC',modifyDt=CURRENT TIMESTAMP
WHERE transid in (SELECT P2.transid
FROM ProdChanges P2
WHERE P2.processingStatus='ERPQUE'
ORDER BY P2.ITMNUMBER ASC,P2.SKUCode ASC,P2.SKUInventory DESC,P2.SellOut DESC
FETCH FIRST 500 ROWS ONLY);
报order不期望的。
怎么改?
------解决方案--------------------------------------------------------
- SQL code
UPDATE ProdChanges SET processingStatus='ERPPRC',modifyDt=CURRENT TIMESTAMP WHERE transid in ( select transid from ( SELECT P2.transid ,ROW_NUMBER() over(ORDER BY P2.ITMNUMBER ASC,P2.SKUCode ASC,P2.SKUInventory DESC,P2.SellOut DESC ) as rownum FROM ProdChanges P2 WHERE P2.processingStatus='ERPQUE' ) a where rownum <= 500)