次のクエリは、内部残高があり、毎日のデータが必要な場合の残高数量を表示しません。
SELECT I.Date as Date,
P.ResourceName as ItemName,
P.ResourceRate as Rate,
i.TotalInQty as InwardsQuantity,
s.TotalOutQty as OutwardsQuantity,
i.TotalInQty-S.TotalOutQty as Balance,
O.UnitSymbol As ItemUnit
FROM UnitMaster O
INNER JOIN Resource_Master P
ON O.UnitCode = P.Unitcode
LEFT JOIN
(
select COALESCE(sum(i.Qty), 0) AS TotalInQty, Nameofitem, Min(I.Date) AS Date
from Inwards_Master I
group by Nameofitem
) I
ON I.Nameofitem= P.ResourceName
LEFT JOIN
(
select COALESCE(sum(s.qty), 0) AS TotalOutQty, Nameofitem, Min(S.Date) AS Date
from Outwards_Master S
group by s.Nameofitem
) S
ON I.Date=S.Date
AND I.Nameofitem =S.Nameofitem
WHERE P.TenderCode=1
これについて洞察を与える機関はありますか?