SELECT LG_xxx_xx_ORFICHE.DATE_ AS 'SİPARİŞ TARİHİ', LG_xxx_xx_ORFLINE.DUEDATE AS 'TESLİM TARİHİ', LG_SLSMAN.DEFINITION_ AS 'ST', LG_xxx_CLCARD.TOWN AS 'İlçe', LG_xxx_SHIPINFO.NAME AS 'Sip.Sevk Adresi', LG_xxx_xx_ORFICHE.FICHENO AS 'FİŞ NO', LG_xxx_CLCARD.CODE AS 'Cari Kodu', LG_xxx_CLCARD.DEFINITION_ AS 'CARİ ÜNVAN', LG_xxx_CLCARD.TRADINGGRP AS 'Snf', LG_xxx_MARK.DESCR AS 'Marka', LG_xxx_ITEMS.CODE AS 'MAM..KOD', LG_xxx_ITEMS.NAME AS 'MAMÜL', Sum((LG_xxx_xx_ORFLINE.AMOUNT)-(LG_xxx_xx_ORFLINE.SHIPPEDAMOUNT+LG_xxx_xx_ORFLINE.ONVEHICLE)) AS 'Sip.', LG_xxx_UNITSETL.CODE AS 'Birim', Sum(((LG_xxx_xx_ORFLINE.TOTAL-LG_xxx_xx_ORFLINE.DISTDISC)/(LG_xxx_xx_ORFLINE.AMOUNT))*(LG_xxx_xx_ORFLINE.AMOUNT-(LG_xxx_xx_ORFLINE.SHIPPEDAMOUNT+LG_xxx_xx_ORFLINE.ONVEHICLE))) AS 'BEKLEYEN TOTAL', (LG_xxx_xx_ORFLINE.DISTDISC/LG_xxx_xx_ORFLINE.TOTAL) AS 'Logo İsk %', LG_xxx_xx_ORFLINE.DISCPER AS 'BEDELSİZ'
FROM UNITY.dbo.LG_xxx_xx_ORFICHE LG_xxx_xx_ORFICHE, UNITY.dbo.LG_xxx_xx_ORFLINE LG_xxx_xx_ORFLINE, UNITY.dbo.LG_xxx_CLCARD LG_xxx_CLCARD, UNITY.dbo.LG_xxx_ITEMS LG_xxx_ITEMS, UNITY.dbo.LG_xxx_MARK LG_xxx_MARK, UNITY.dbo.LG_xxx_SHIPINFO LG_xxx_SHIPINFO, UNITY.dbo.LG_xxx_UNITSETF LG_xxx_UNITSETF, UNITY.dbo.LG_xxx_UNITSETL LG_xxx_UNITSETL, UNITY.dbo.LG_SLSMAN LG_SLSMAN
WHERE LG_xxx_xx_ORFICHE.LOGICALREF = LG_xxx_xx_ORFLINE.ORDFICHEREF AND LG_xxx_xx_ORFLINE.CLIENTREF = LG_xxx_CLCARD.LOGICALREF AND LG_xxx_ITEMS.LOGICALREF = LG_xxx_xx_ORFLINE.STOCKREF AND LG_xxx_xx_ORFLINE.SALESMANREF = LG_SLSMAN.LOGICALREF AND LG_xxx_xx_ORFICHE.SHIPINFOREF = LG_xxx_SHIPINFO.LOGICALREF AND LG_xxx_xx_ORFLINE.USREF = LG_xxx_UNITSETF.LOGICALREF AND LG_xxx_xx_ORFLINE.UOMREF = LG_xxx_UNITSETL.LOGICALREF AND LG_xxx_UNITSETF.LOGICALREF = LG_xxx_UNITSETL.UNITSETREF AND LG_xxx_MARK.LOGICALREF = LG_xxx_ITEMS.MARKREF AND ((LG_xxx_xx_ORFLINE.STATUS=4) AND (LG_xxx_xx_ORFLINE.TOTAL-LG_xxx_xx_ORFLINE.DISTDISC>0) AND (((LG_xxx_xx_ORFLINE.TOTAL-LG_xxx_xx_ORFLINE.DISTDISC)/(LG_xxx_xx_ORFLINE.AMOUNT))*(LG_xxx_xx_ORFLINE.AMOUNT-(LG_xxx_xx_ORFLINE.SHIPPEDAMOUNT+LG_xxx_xx_ORFLINE.ONVEHICLE))>0))
GROUP BY LG_xxx_xx_ORFICHE.DATE_, LG_xxx_xx_ORFLINE.DUEDATE, LG_SLSMAN.DEFINITION_, LG_xxx_CLCARD.TOWN, LG_xxx_SHIPINFO.NAME, LG_xxx_xx_ORFICHE.FICHENO, LG_xxx_CLCARD.CODE, LG_xxx_CLCARD.DEFINITION_, LG_xxx_CLCARD.TRADINGGRP, LG_xxx_MARK.DESCR, LG_xxx_ITEMS.CODE, LG_xxx_ITEMS.NAME, LG_xxx_UNITSETL.CODE, (LG_xxx_xx_ORFLINE.DISTDISC/LG_xxx_xx_ORFLINE.TOTAL), LG_xxx_xx_ORFLINE.DISCPER, LG_xxx_xx_ORFLINE.LINETYPE
HAVING (LG_xxx_xx_ORFLINE.LINETYPE In (0,1,6)) AND (LG_xxx_MARK.DESCR Not Like 'HEDİYE%')
ORDER BY LG_xxx_xx_ORFICHE.DATE_, LG_xxx_xx_ORFICHE.FICHENO DESC, LG_xxx_CLCARD.CODE, LG_xxx_CLCARD.DEFINITION_
Ben mevcut bu sorgum ile Koşullu bir şekilde bekleyen siparişlerimi detaylı şekilde çekebiliyorum. Belki işinize yarar.