I modified the top SELECT statement because these 2 fields are requested to be displayed:
select s.issue_id, ii.issue_name,d1.par_amount as deal_1_par_amount,d2.par_amount as deal_2_par_amount, abs(coalesce(s.d1_par, 0.0) - coalesce(s.d2_par, 0.0)) as par_difference
[...]
However, T-SQL throws the following errors:
"Msg 4104, Level 16, State 1, Line 5
The multi-part identifier "d1.par_amount" could not be bound.
Msg 4104, Level 16, State 1, Line 5
The multi-part identifier "d2.par_amount" could not be bound."
because those two fields are in the nested SELECT.
select s.issue_id, ii.issue_name,d1.par_amount as deal_1_par_amount,d2.par_amount as deal_2_par_amount, abs(coalesce(s.d1_par, 0.0) - coalesce(s.d2_par, 0.0)) as par_difference
[...]
However, T-SQL throws the following errors:
"Msg 4104, Level 16, State 1, Line 5
The multi-part identifier "d1.par_amount" could not be bound.
Msg 4104, Level 16, State 1, Line 5
The multi-part identifier "d2.par_amount" could not be bound."
because those two fields are in the nested SELECT.