I have two tables
Joined_courses_table
---------------------------------------
id course1_id course2_id
---------------------------------------
1 33 3
2 2 1
---------------------------------------
Results_table
---------------------------------------
course_id value
---------------------------------------
33 50
3 40
2 70
1 130
---------------------------------------
Problem -> I want the Values Sum from results_table for each two pairs in the Joined_courses_table