Sitede şöyle bir sorgu buldum. Sizde ek olarak elinizdeki son alışı buraya ekleyip sonucu gözlemleyebilirsiniz.
SELECT DISTINCT
dbo.LG_020_01_ORFICHE.FICHENO, dbo.LG_020_CLCARD.CODE, dbo.LG_020_CLCARD.DEFINITION_, dbo.LG_020_ITEMS.CODE AS Expr1, dbo.LG_020_ITEMS.NAME,
dbo.LG_020_01_ORFLINE.AMOUNT,
(SELECT DISTINCT SUM(dbo.LG_020_01_STLINE.AMOUNT)
FROM dbo.LG_020_01_STLINE WHERE (dbo.LG_020_01_STLINE.ORDFICHEREF=LG_020_01_ORFLINE.ORDFICHEREF)AND(dbo.LG_020_01_STLINE.STOCKREF=LG_020_01_ORFLINE.STOCKREF) AND (dbo.LG_020_01_STFICHE.DOCODE!='' )AND (dbo.LG_020_01_STFICHE.CANCELLED=0) AND (dbo.LG_020_01_STLINE.STFICHEREF=LG_020_01_STFICHE.LOGICALREF)AND dbo.LG_020_01_STLINE.TRCODE=8 AND LG_020_01_ORFLINE.CLIENTREF=LG_020_01_STLINE.CLIENTREF AND LG_020_01_ORFICHE.LOGICALREF=LG_020_01_STLINE.ORDFICHEREF ) AS GIDEN
FROM dbo.LG_020_01_ORFICHE LEFT OUTER JOIN
dbo.LG_020_01_ORFLINE ON dbo.LG_020_01_ORFICHE.LOGICALREF = dbo.LG_020_01_ORFLINE.ORDFICHEREF LEFT OUTER JOIN
dbo.LG_020_CLCARD ON dbo.LG_020_01_ORFICHE.CLIENTREF = dbo.LG_020_CLCARD.LOGICALREF LEFT OUTER JOIN
dbo.LG_020_ITEMS ON dbo.LG_020_01_ORFLINE.STOCKREF = dbo.LG_020_ITEMS.LOGICALREF LEFT OUTER JOIN
dbo.LG_020_01_STLINE ON dbo.LG_020_01_ORFICHE.LOGICALREF = dbo.LG_020_01_STLINE.ORDFICHEREF LEFT OUTER JOIN
dbo.LG_020_01_STFICHE ON dbo.LG_020_01_STLINE.STFICHEREF = dbo.LG_020_01_STFICHE.LOGICALREF
WHERE (dbo.LG_020_01_ORFICHE.TRCODE = 1) AND dbo.LG_020_01_STLINE.TRCODE=8 AND LG_020_01_ORFLINE.CANCELLED=0 AND dbo.LG_020_01_STFICHE.CANCELLED=0