//Below is my code for my solution
if (SELECT Student_ID,Fee_Type, SUM(amount) AS paid FROM FeePaid_Details WHERE (Student_ID = 'PS20130001') AND (Fee_Type = 'Admission Fee') AND (Month_Details = 'jan') GROUP BY Student_ID, Fee_Type) and (SELECT Student_ID,Fee_Type, SUM(amount) AS paid FROM FeePaid_Details WHERE (Student_ID = 'PS20130001') AND (Fee_Type = 'Admission Fee') AND (Month_Details = 'feb') GROUP BY Student_ID, Fee_Type)
begin
select q.Student_ID,q.Fee_Type,q.amount,q.amount-p.paid as Current_month_due,q.amount-g.paid as previous_month_due,(q.amount-g.paid)+(q.amount-p.paid) as total_amount from Student_Fee_Quotations q join(select d.Student_ID,d.Fee_Type,sum(d.amount) as paid from FeePaid_Details d where d.Student_ID='PS20130001' and d.Fee_Type='Admission Fee' and d.Month_Details='jan' group by d.Student_ID,d.Fee_Type )as g on q.Student_ID='PS20130001' and q.Fee_Type='Admission Fee' join (select d.Student_ID,d.Fee_Type,sum(d.amount) as paid from FeePaid_Details d where d.Student_ID='PS20130001' and d.Fee_Type='Admission Fee' and d.Month_Details='feb' group by d.Student_ID,d.Fee_Type ) as p on q.Student_ID='PS20130001' and q.Fee_Type='Admission Fee'
end
else if (SELECT Student_ID,Fee_Type, SUM(amount) AS paid FROM FeePaid_Details WHERE (Student_ID = 'PS20130001') AND (Fee_Type = 'Admission Fee') AND (Month_Details = 'jan') GROUP BY Student_ID, Fee_Type) or (SELECT Student_ID,Fee_Type, SUM(amount) AS paid FROM FeePaid_Details WHERE (Student_ID = 'PS20130001') AND (Fee_Type = 'Admission Fee') AND (Month_Details = 'feb') GROUP BY Student_ID, Fee_Type)
begin
if (SELECT Student_ID,Fee_Type, SUM(amount) AS paid FROM FeePaid_Details WHERE (Student_ID = 'PS20130001') AND (Fee_Type = 'Admission Fee') AND (Month_Details = 'jan') GROUP BY Student_ID, Fee_Type)
begin
select q.Student_ID,q.Fee_Type,q.amount,q.amount as Current_month_due,q.amount-g.paid as previous_month_due,(q.amount-g.paid)+(q.amount) as total_amount from Student_Fee_Quotations q join(select d.Student_ID,d.Fee_Type,sum(d.amount) as paid from FeePaid_Details d where d.Student_ID='PS20130001' and d.Fee_Type='Admission Fee' and d.Month_Details='jan' group by d.Student_ID,d.Fee_Type )as g on q.Student_ID='PS20130001' and q.Fee_Type='Admission Fee'
end
else(SELECT Student_ID,Fee_Type, SUM(amount) AS paid FROM FeePaid_Details WHERE (Student_ID = 'PS20130001') AND (Fee_Type = 'Admission Fee') AND (Month_Details = 'feb') GROUP BY Student_ID, Fee_Type)
begin
select q.Student_ID,q.Fee_Type,q.amount,q.amount-p.paid as Current_month_due,0 as previous_month_due,(q.amount-p.paid) as total_amount from Student_Fee_Quotations q join(select d.Student_ID,d.Fee_Type,sum(d.amount) as paid from FeePaid_Details d where d.Student_ID='PS20130001' and d.Fee_Type='Admission Fee' and d.Month_Details='feb' group by d.Student_ID,d.Fee_Type ) as p on q.Student_ID='PS20130001' and q.Fee_Type='Admission Fee'
end
end
else
begin
select Student_ID,Fee_Type,amount,amount as Current_month_due,0 as previous_month_due,amount as total_amount from Student_Fee_Quotations where Student_ID='PS20130001' and Fee_Type='Admission Fee'
end
//after executing this these are the errors i am facing
Msg 4145, Level 15, State 1, Line 1
An expression of non-boolean type specified in a context where a condition is expected, near 'and'.
Msg 156, Level 15, State 1, Line 5
Incorrect syntax near the keyword 'else'.
Msg 4145, Level 15, State 1, Line 5
An expression of non-boolean type specified in a context where a condition is expected, near 'or'.
Msg 4145, Level 15, State 1, Line 8
An expression of non-boolean type specified in a context where a condition is expected, near 'begin'.
Msg 156, Level 15, State 1, Line 11
Incorrect syntax near the keyword 'else'.
Msg 156, Level 15, State 1, Line 16
Incorrect syntax near the keyword 'else'.