Hot answers tagged

1

Because you have four tables establishing the hierarchy you can simply join all of the elements directly: SELECT level1.key1 ,level1.key2 ,level2.key3 ,level3.key4 FROM table1 level1 LEFT JOIN table2 level2 ON level2.key2 = level1.key2 LEFT JOIN table3 level3 ON level3.key3 = level2.key3


1

You are probably using a method to return data which needs unique column names, for example because it uses the column names as keys in a hash. You can add aliases to make the column names unique. This is the first line of your query with aliases: SELECT certifications.*, users.name as user_name, company.name as company_name, certstype.name as ...


Only top voted, non community-wiki answers of a minimum length are eligible