- Katılım
- 25 May 2018
- Mesajlar
- 1,608
- En iyi yanıt
- 14
- Puanları
- 113
- Konum
- İstanbul
- Web sitesi
- excelarsivi.com
- Ad Soyad
- Murat OSMA
- Office Vers.
- Office 365 TR+EN
Logo'da Aylık Hizmet Satış Raporu tablosu için bu sorguyu kullanabilirsiniz.
[HIDEREPLYTHANKS]
[/HIDEREPLYTHANKS]
Sonuç Tablo
[HIDEREPLYTHANKS]
SQL:
SELECT SNM.HIZMETKODU,SNM.HIZMETADI,
SUM(SNM.TOPLAM)TOPLAM,SUM(SNM.OCASATIS)OCAK,
SUM(SNM.SUBSATIS)SUBAT,SUM(SNM.MARSATIS)MART,SUM(SNM.NISSATIS)NISAN,SUM(SNM.MAYSATIS)MAYIS,
SUM(SNM.HAZSATIS)HAZIRAN,SUM(SNM.TEMSATIS)TEMMUZ,SUM(SNM.AGUSATIS)AGUSTOS,SUM(SNM.EYLSATIS)EYLUL,
SUM(SNM.EKISATIS)EKIM,SUM(SNM.KASSATIS)KASIM,SUM(SNM.ARASATIS)ARALIK
FROM(SELECT (SELECT SRV.CODE FROM LG_115_SRVCARD SRV WHERE SRV.LOGICALREF=S.STOCKREF)AS HIZMETKODU,
(SELECT SRV.DEFINITION_ FROM LG_115_SRVCARD SRV WHERE SRV.LOGICALREF=S.STOCKREF)AS HIZMETADI,
ISNULL(SUM(S.VATMATRAH),0) AS TOPLAM,
ISNULL(CASE WHEN MONTH(S.DATE_)=1 THEN SUM(S.VATMATRAH) END,0) AS OCASATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=2 THEN SUM(S.VATMATRAH) END,0) AS SUBSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=3 THEN SUM(S.VATMATRAH) END,0) AS MARSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=4 THEN SUM(S.VATMATRAH) END,0) AS NISSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=5 THEN SUM(S.VATMATRAH) END,0) AS MAYSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=6 THEN SUM(S.VATMATRAH) END,0) AS HAZSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=7 THEN SUM(S.VATMATRAH) END,0) AS TEMSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=8 THEN SUM(S.VATMATRAH) END,0) AS AGUSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=9 THEN SUM(S.VATMATRAH) END,0) AS EYLSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=10 THEN SUM(S.VATMATRAH) END,0) AS EKISATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=11 THEN SUM(S.VATMATRAH) END,0) AS KASSATIS,
ISNULL(CASE WHEN MONTH(S.DATE_)=12 THEN SUM(S.VATMATRAH) END,0) AS ARASATIS,
(SELECT SRV.SPECODE FROM LG_115_SRVCARD SRV WHERE SRV.LOGICALREF=S.STOCKREF)AS SPECODE,
(SELECT SRV.CYPHCODE FROM LG_115_SRVCARD SRV WHERE SRV.LOGICALREF=S.STOCKREF)AS SPECODE2,
(SELECT TAXDEF FROM LG_115_ADDTAX WHERE LOGICALREF=
(SELECT ADDTAXREF FROM LG_115_SRVCARD WHERE LOGICALREF=S.STOCKREF)) AS SPECODE3
FROM LG_115_01_STLINE S WHERE S.INVOICEREF>0 AND S.CANCELLED=0
AND S.TRCODE IN(9) AND S.STOCKREF>0
GROUP BY S.STOCKREF, MONTH(S.DATE_)) AS SNM WHERE 1=1
GROUP BY SNM.HIZMETKODU,SNM.HIZMETADI ,SNM.SPECODE,SNM.SPECODE2,SNM.SPECODE3
Sonuç Tablo
Son düzenleme: