Question : How to write script for the requirment?

I have the below table and result.
Requirement is I need to find the Reverse amount from the table. For example, in first record Object A is in Site1 =1 and site2=10 and Amt= 100 and if the same object is in Site1=10 and Site2=1 (reverse site) then amt= 200. So in my result I need to show 200 in the reverseAmt column for this record.Please let me know how to do this task. I really appreciate your help.
Table:
Object      site1      site2      Amt
A      1      10      100
A      10      1      200
A      2      50      600
B      2      50      700
B      50      2      100

RESULT:                        
Object      site1      site2      amt      ReverseAmt
A      1      10      100      200
A      10      1      200      100
A      2      50      600      0
B      2      50      700      100
B      50      2      100      700


Answer : How to write script for the requirment?

See if it works:

select Table1.Object,
       Table1.site1,
       Table1.site2,
       Table1.Amt,
       isnull(Table2.Amt, 0) as ReverseAmt
  from Table1 left join (select Object,
                                 site2 as site1,
                                 site1 as site2,
                                 Amt
                            from Table1) Table2
       on (Table1.Object = Table2.Object and Table1.site1 = Table2.site1 and Table1.site2 = Table2.site2)
Random Solutions  
 
programming4us programming4us