SQL :

MySql Format:

select SUM(Qty) from salesline 
JOIN INVENTTRANSORIGIN 
ON salesline.INVENTTRANSID = INVENTTRANSORIGIN.INVENTTRANSID AND INVENTTRANSORIGIN.DATAAREAID='usmf'
JOIN INVENTTRANS
on INVENTTRANS.INVENTTRANSORIGIN = INVENTTRANSORIGIN.RECID AND INVENTTRANS.DATAAREAID='usmf'
where salesline.SALESID = '000697' and salesline.ITEMID= 'L0001' AND salesline.DATAAREAID='usmf' 
AND ( INVENTTRANS.STATUSISSUE =4 OR INVENTTRANS.STATUSISSUE =5)

 

D365 format:

 select Sum(Qty) from  inventTrans
                JOIN inventTransOrigin
                where  inventTrans.INVENTTRANSORIGIN == inventTransOrigin.RECID
                  JOIN salesLine2
                where 
                salesLine2.RecId == salesLine.RecId &&
                salesLine2.INVENTTRANSID == inventTransOrigin.INVENTTRANSID && inventTransOrigin.DATAAREAID==salesLine.DataAreaId
                && (inventtrans.StatusIssue == 4 || INVENTTRANS.STATUSISSUE ==5) && inventTrans.DATAAREAID==salesline.DataAreaId;
                            

文章標籤
創作者介紹
創作者 lionlionchopper 的頭像
lionlionchopper

呆子獅的夢想世界

lionlionchopper 發表在 痞客邦 留言(0) 人氣()