This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
kurs:joins [2010/04/16 14:27] mh |
kurs:joins [2020/05/11 12:03] admin |
||
---|---|---|---|
Line 52: | Line 52: | ||
+ | </code> | ||
+ | |||
+ | Join über mehrere Tabellen hinweg | ||
+ | <code> | ||
+ | SELECT | ||
+ | first_name, | ||
+ | last_name, | ||
+ | coalesce(department_name, '[kein department]'), | ||
+ | city, | ||
+ | country_name, | ||
+ | region_name | ||
+ | FROM | ||
+ | hr.employees | ||
+ | left JOIN hr.departments ON employees.department_id = departments.department_id | ||
+ | left join hr.locations on departments.location_id = locations.location_id | ||
+ | left join hr.countries on locations.country_id = countries.country_id | ||
+ | left join hr.regions on countries.region_id = regions.region_id | ||
+ | where region_name = 'Europe' | ||
</code> | </code> |