SELECT I.COMPANY, I.PLANT, I.WAREHOUSE, I.STOCKPLACE,
I.SPECIALSTOCK, I.MATERIAL,
MAX( I.SKUNIT ) AS SKUNIT, MAX( M.STEXT ) AS STEXT
, SUM( I.SKQUANTITY * ( 1 - 2 * I.QPOSTWAY ) ) AS TOTALSTOCK
, MAX( I.ISVARIANT ) AS ISVARIANT
, MAX( I.VARIANTKEY ) AS VARIANTKEY
, MAX( I.VOPTIONS ) AS VOPTIONS
,I.PROJECT,I.CONFIRMATION,I.CONFIRMPOS,I.BATCHNUM
FROM IASINVITEM I WITH (NOLOCK), IASMATX M WITH(NOLOCK)
WHERE I.CLIENT = '00' AND I.COMPANY LIKE '01' AND I.PLANT LIKE '01'
AND I.WAREHOUSE LIKE '008' AND I.STOCKPLACE LIKE '01'
AND I.SPECIALSTOCK LIKE '%' AND I.MATERIAL LIKE '%'
AND I.CREATEDAT <= '11.21.2012 12:15:00'
AND M.CLIENT = I.CLIENT
AND M.COMPANY = I.COMPANY AND M.PLANT = '*' AND M.LANGU = 'T'
AND M.MATERIAL = I.MATERIAL
AND M.VALIDFROM <= I.CREATEDAT
AND M.VALIDUNTIL >= I.CREATEDAT
AND I.ISCANCELED = 0
GROUP BY I.COMPANY, I.PLANT, I.WAREHOUSE, I.STOCKPLACE
, I.SPECIALSTOCK, I.MATERIAL
,I.ISVARIANT ,I.VARIANTKEY,I.VOPTIONS,I.PROJECT,I.CONFIRMATION
,I.CONFIRMPOS,I.BATCHNUM
HAVING SUM( I.SKQUANTITY * ( 1 - 2 * I.QPOSTWAY ) ) > 0.01 OR
SUM( I.SKQUANTITY * ( 1 - 2 * I.QPOSTWAY ) ) < -0.01
ORDER BY I.COMPANY, I.MATERIAL,I.VOPTIONS, I.PLANT, I.WAREHOUSE
, I.STOCKPLACE, I.SPECIALSTOCK
IAS ta saat kriterine göre anlık stok çekmek
Cevapla