I need something like this but I am not able to construct my statement. If within date range, I need to do an "if else" test as per below:
Code:sum(case when convert(varchar(10), i.date, 112) >= convert(varchar(10), @DateFromCurrMonth, 112) and convert(varchar(10), i.date, 112) < convert(varchar(10), @DateToCurrMonth, 112) then if i.mode = 'J' and p.petroEXcode = 'Y2'THEN convert(decimal(15,2),i.net) else convert(decimal(15,2),i.net) * 42 END) as netqtythismonth