title: Declaring two references for a table
body: <p>I want to fetch some records from different table based on some condition. These tables are somehow relational but my query is giving compilation error.</p>
  <p><strong>This query is get course id of two different classes:</strong></p>
  <pre><code>select c.id, c1.id
  FROM college.student s 
  left join college.classroom (p1, p2) on p1.class_id=s.child_id 
                                      and p2.class_id=s.parent_id 
  left join college.course (c, c1) on p1.class_id=c.id 
                                   and p2.class_id=c1.id;
  </code></pre>
  <p>I want to take p1,p2 both join them like this. Basically having two joining. Basically just wanted to know how to join taking two different references of same table.</p>