SQL JOIN using a mapping table
I have three tables: COLLECTION PERSON PERSON_COLLECTION where PERSON_COLLECTION is a mapping table id|person_id|collection_id I now want to select all entries in collection and order them by person.name . Do I have to join the separate tables with the mapping table first and then do a join again on the results? SELECT c.*, p.Name FROM Collection c JOIN Person_Collection pc ON pc.collection_id = c.id JOIN Person p ON p.id = pc.person_id ORDER BY p.Name The order you join won't break it but depending on which sql product you're using may effect performance. You need to decide if you want ALL