日期:2014-05-18 浏览次数:20466 次
SELECT PID,SaleOrderID,MaterialID,NewOrderNum,OldOrderNum,OldBuyIn FROM st_NeedBuyIn AS A WHERE EXISTS ( SELECT MaterialID,Number FROM HtSaleProductDetail AS B WHERE SaleProductID=( SELECT AlreadySaleProduct FROM HtSaleOrder WHERE PID=24 ) AND A.MaterialID=B.MaterialID)
SELECT PID,SaleOrderID,MaterialID,NewOrderNum,OldOrderNum,(OldBuyIn*B.Number) OldBuyIn FROM st_NeedBuyIn AS A join HtSaleProductDetail AS B on A.MaterialID=B.MaterialID join (SELECT AlreadySaleProduct FROM HtSaleOrder WHERE PID=24) as C ON B.SaleProductID=C.AlreadySaleProduct