【发布时间】:2021-04-18 16:18:48
【问题描述】:
我正在尝试加入下面的 2 个表格
表 1:
| Name | city | Country | Enabled |
|------|--------|---------|---------|
| Alex | London | UK | 1 |
| Burt | Berlin | DE | 0 |
| Carl | Moscow | RU | 1 |
表 2:
| Name | post code | street |
|-------|-----------|--------|
| Burt | 1234 | Road1 |
| Darek | 5678 | Road2 |
对于想要的结果
| Name | city_t1 | country_t1 | enabled_t1 | post_code | Street |
|-------|---------|------------|------------|-----------|--------|
| Alex | London | UK | 1 | NULL | NULL |
| Burt | Berlin | DE | 0 | 1234 | Road1 |
| Carl | Moscow | RU | 1 | NULL | NULL |
| Darek | NULL | NULL | NULL | 5678 | Road2 |
有人可以帮我写一下这个的sql代码吗?
【问题讨论】:
-
向我们展示未给您预期结果的查询。
标签: sql join outer-join