I have the following sql and I am trying to get the sum of (total + total) but in somehow it does not give me the right sum. This is the part of the code that I am having trouble with. I put in bold
set nocount on
declare
@start datetime,
@end datetime,
@campaignId uniqueidentifier,
@campaignName varchar(250),
@segment varchar(50)
set @start = '2015-10-07'
set @end = '2015-10-16'
set @campaignId = 'DBCC960D-ADE1-4828-A632-0BDD994A64A6'
set @segment = 'P51,P53'
create table #camps
(
Seq int identity(1,1),
Id uniqueidentifier,
Name varchar(50)
)
create table #sales2
(
Campaign varchar(250) null,
Segment varchar(50) null,
Verified varchar(50) null,
[Pledges] int null,
[Amount] money null
)
if @campaignId is null and @campaignName is null begin
insert #camps
exec asdm.dbo.[sp_GetActiveCampaignsInPrd] @start, @end
end else if @campaignId is not nul ...
Go to the complete details ...