Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

Merge SQL Selects

$
0
0

hi everyone,

i tried to get these two scripts together:

SQL
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
withusrShowAuftragsbestandCTEas(selectBerechnungsDatumasDuedate,Netto,ZielgebietfromusrShowAuftragsbestandwhereWaehrung='CHF')selectDuedate,round(SUM(Netto),2)asNettoSumme,ZielgebietfromusrShowAuftragsbestandCTEWHEREDATEDIFF(DAY,Duedate,GETDATE())<14groupbyDuedate,ZielgebietorderbyDuedatedesc,Zielgebiet
and here the second one:
SQL
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
withusrShowAuftragsbestandCTEas(selectBerechnungsDatumasDuedate,NettofromusrShowAuftragsbestandwhereWaehrung='CHF'andLieferterminisnull)selectDuedate,round(SUM(Netto),2)asNettoSummefromusrShowAuftragsbestandCTEWHEREDATEDIFF(DAY,Duedate,GETDATE())<14groupbyDuedateorderbyDuedatedesc

i'm not very good in SQL - so any advice is welcome :)

thanks and regards


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>