Hi
Incorrect syntax near the keyword 'Select'. & Must declare the scalar variable "@Opening".
Declare @fr_Date as Date
Set @fr_Date = '2011/11/11'
declare @to_Date as Date
Set @to_date = '2021/10/10'
Declare @Opening as double
Select @Opening = (SUM(Credit)-SUM(Debit)) from JDT1 where RefDate < '2010/11/11'
Union all
Select (SUM(JDT1.Credit)-SUM(JDT1.Debit)) from
OJDT inner join JDT1 on OJDT.transid = JDT1.transid
AND JDT1.RefDate >= '2010/11/11' AND JDT1.RefDate < @fr_date
Thanks