SELECT Stocks.PRODUCT, Stocks.Remark, Stocks.MATW, Stocks.MATL, Stocks.MATH, Stocks.MATT, Stocks.Color, Stocks.Strong, ISNULL(Stocks.Amount,0)As Amount ,
SUM(ISNULL(MarkingDetail.Amount_Requis,0)) AS Amount_Requis, ISNULL(Stocks.Amount,0) - SUM(ISNULL(MarkingDetail.Amount_Requis,0)) AS Total, Stocks.GradName,
Stocks.UNIT, Stocks.WeightSize,Sum(ISNULL(MarkingDetail.Amount_Requis,0))As Amount_Requis
FROM Stocks ,MarkingDetail
WHERE Stocks.PRODUCT = MarkingDetail.Product
And MarkingDetail.StatusEditRequis = 'false'
GROUP BY Stocks.Remark, Stocks.MATW, Stocks.MATL, Stocks.MATH, Stocks.MATT, Stocks.Color, Stocks.Strong, Stocks.PRODUCT, Stocks.Amount,
Stocks.GradName, Stocks.UNIT, Stocks.WeightSize
ORDER BY Stocks.PRODUCT
Tag : .NET, MySQL, Ms SQL Server 2008, VB.NET
Date :
2012-02-24 09:57:48
By :
chin
View :
1037
Reply :
1
No. 1
Guest
แบบนี้ก็ทำ
FROM Stocks FULL OUTER JOIN
MarkingDetail ON Stocks.PRODUCT = MarkingDetail.Product
WHERE (MarkingDetail.StatusEditRequis = 'false')
ก็ไม่ได้