我想加入Tableau的两张桌子。我不想丢失任何条目,所以我使用了一个完整的外部联接:
数据如下所示
表1:
Name1 Status Storage Certificate
gbo001 Running 16GB on
gbo003 Running 16GB on
gbo005 Running 16GB on
gbo006 Running 16GB onTable2
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是否可以相应地调整我的查询,以便从两个表中看到所有现有条目?
发布于 2021-02-03 09:13:36
如果有人在tableau上遇到了类似的问题,几天前我就遇到了这种情况,在几个小时前,为了弄清楚为什么Tableau创建了一个左连接而不是一个完全连接,我决定关闭Tableau,重新打开Tableau,而实际上是工作的。所以我想这周围有某种虫子。
希望这能节省一些时间。
https://stackoverflow.com/questions/47095817
复制相似问题