RETURNS TABLE
AS
RETURN
(
with Documents as
(
select TOP 100 PERCENT d.LeEn, d.Wacode, d.Waname, d.Arcode, d.Arname, sum(d.Quantity) as Quantity from Documents as d
where (select max(DocumentDate) from Documents as d where d.DocumentCode = 'INW') <= d.DocumentDate
group by d.LeEn, d.WarehouseCode, d.Waname, d.Arcode, d.Arname
order by d.LeEn, d.WarehouseCode, d.Arcode
)
)
和我得到這個
附近有語法錯誤)「。
有什麼想法?
用你正在使用的數據庫標記你的問題。 –