sql - Inserting dummy values at the end of select -


i have got query returns address , completed orders against each address last week. need insert 3 dummy values within result set.

select  address     ,sum(case when  orderdate >= dateadd(dd,(datediff(dd,-53690,getdate()-1)/7)*7,-53690)               1             else 0              end) completed orders  group address order address 

result

address--------------completed

address1----------------3

address2----------------3

address3----------------3

address4----------------3

all values coming database, want insert 3 rows hard coded values

expected result

address--------------completed

address1----------------3

address2----------------3

address3----------------3

address4----------------3

dummy1------------------0

dummy2------------------0

dummy3------------------0

unsuccessful attempt

select  address     ,sum(case when  orderdate >= dateadd(dd,(datediff(dd,-53690,getdate()-1)/7)*7,-53690)               1             else 0              end) completed orders   union  select     'dummy1', 0 group address order address 

try -

select  address ,sum(case when  orderdate >= dateadd(dd,(datediff(dd,-53690,getdate()-1)/7)*7,-53690)           1         else 0          end) completed orders  union  select   'dummy1' address, sum(0) completed  group address order address 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -