为什么Tableau全外连接的行为类似于左连接?

时间:2017-11-03 12:27:12

标签: amazon-redshift tableau full-outer-join

我想在Tableau上加入两个表。我不想丢失任何条目,因此我使用完整的外部联接:

数据看起来像这样

表1:

Name1         Status     Storage   Certificate
gbo001     Running         16GB         on
gbo003     Running         16GB         on
gbo005     Running         16GB         on
gbo006     Running         16GB         on

表2

Name2      Price
gbo001     10000
gbo002     12000
gbo003     12000 
gbo004     16000
gbo006     11000
gbo007     14000

所以我使用完全外连接,这是我的查询:

SELECT "Table_1"."name1" AS "name1",
  "Table_1"."Status" AS "Status",
  "Table_1"."Storage" AS "Storage",
  "Table_1"."Certificate" AS "Certificate",
  "Table_2"."Name2" AS "Name2",
  "Table_2"."Price" AS "Price",
 FROM "public"."Table1" "Table1"
  FULL JOIN "public"."Table2" "Table2" ON ("Table1"."Name1" = "Table2"."Name2")

奇怪的是,它给了我与左连接相同的结果:

Name1         Status     Storage   Certificate   Name2     Price
gbo001     Running         16GB         on       gbo001     10000
gbo003     Running         16GB         on       gbo001     12000
gbo005     Running         16GB         on       null       null
gbo006     Running         16GB         on       gbo006     11000

这些是我期待的完整外部联接的结果:

Name1         Status     Storage   Certificate     Name2       Price
gbo001     Running         16GB         on         gbo001      10000
 null       null           null        null        gbo002      12000 
gbo003     Running         16GB         on         gbo003      12000
 null       null           null        null        gbo004      16000
gbo005     Running         16GB         on         null        null 
gbo006     Running         16GB         on         gbo006      11000
 null       null           null        null        gbo007      14000

是否可以相应地调整我的查询,以便我可以看到两个表中的所有现有条目?

1 个答案:

答案 0 :(得分:0)

万一有人在 Tableau 上遇到类似问题,这发生在我几天前,经过几个小时试图找出为什么 tableau 创建左联接而不是完全联接后,我决定关闭并重新打开 Tableau这实际上奏效了。所以我猜这里面存在某种错误。

希望这可以为某人节省一些时间。

相关问题