SELECT dbo.LG_114_01_INVOICE.DATE_ AS [TARIH] ,
dbo.LG_SLSMAN.DEFINITION_ AS [SATIŞ ELEMANI], dbo.LG_114_ITEMS.CODE AS [URUN KODU],
dbo.LG_114_ITEMS.NAME AS [ÜRÜN ADI],
dbo.LG_114_ITEMS.STGRPCODE AS [URUN GRUP KODU]
,SUM(dbo.LG_114_01_STLINE.AMOUNT) AS ADET,
SUM(dbo.LG_114_01_STLINE.VATMATRAH) AS TUTAR, dbo.LG_114_ITEMS.B2CCODE AS [3GSATF]
FROM dbo.LG_114_01_INVOICE INNER JOIN
dbo.LG_114_01_STLINE ON dbo.LG_114_01_INVOICE.LOGICALREF = dbo.LG_114_01_STLINE.INVOICEREF INNER JOIN
dbo.LG_114_CLCARD ON dbo.LG_114_01_INVOICE.CLIENTREF = dbo.LG_114_CLCARD.LOGICALREF INNER JOIN
dbo.LG_114_ITEMS ON dbo.LG_114_01_STLINE.STOCKREF = dbo.LG_114_ITEMS.LOGICALREF INNER JOIN
dbo.LG_SLSMAN ON dbo.LG_114_01_INVOICE.SALESMANREF = dbo.LG_SLSMAN.LOGICALREF
WHERE (dbo.LG_114_01_INVOICE.DATE_ >=DATEADD(MONTH, DATEDIFF(MONTH, 0, getDate()) , 0))
GROUP BY dbo.LG_114_01_INVOICE.DATE_ , dbo.LG_114_ITEMS.CODE ,
dbo.LG_114_ITEMS.NAME , dbo.LG_SLSMAN.DEFINITION_ ,
dbo.LG_114_ITEMS.STGRPCODE,dbo.LG_114_ITEMS.B2CCODE
No comments:
Post a Comment