Using LEFT JOIN to only selection one joined row
- by Alex
I'm trying to LEFT JOIN two tables, to get a list of all rows from TABLE_1 and ONE related row from TABLE_2. I have tried LEFT JOIN and GROUP BY c_id, however I wan't the related row from TABLE_2 to be sorted by isHeadOffice DESC.
Here are some sample tables
TABLE 1
c_id Name
----------------
1 USA
2 Canada
3 England
4 …