以下查询不显示有向内余额的余额数量,而且我还想要每天的数据:
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
任何机构都可以对此提供见解吗?