Tableau Custom SQL 从 Big Query 表返回 None。

huangapple go评论51阅读模式
英文:

Tableau Custom SQL Returns None from Big Query Table

问题

有其他人遇到过这个问题吗?

我有一个查询:

SELECT * FROM `table-in-big-query` AS t1
INNER JOIN ( SELECT unique_Field, MAX(Upload_Datetime) AS latest_Upload_Datetime FROM `table-in-big-query` GROUP BY unique_Field)
AS t2 ON (t1.unique_Field= t2.unique_Field AND t1.Upload_Datetime = t2.latest_Upload_Datetime)

这会返回unique_Field的最近上传数据行。

当我在Tableau Online的Tableau自定义SQL查询中运行这个查询时,响应中没有行。

我还在Tableau Prep Builder应用程序中检查了一下,以确保不是Tableau Online 的问题...

我已经检查过连接是否有效,只是运行了以下查询:

SELECT * from `table-in-big-query`

它可以工作,所以我不确定哪里出了问题...

英文:

Has anyone else experienced this issue?

I have a query:

SELECT * FROM `table-in-big-query` AS t1
INNER JOIN ( SELECT unique_Field, MAX(Upload_Datetime) AS latest_Upload_Datetime FROM `table-in-big-query` GROUP BY unique_Field)
AS t2 ON (t1.unique_Field= t2.unique_Field AND t1.Upload_Datetime = t2.latest_Upload_Datetime)

This returns the most recent rows of uploaded data for the unique_Field.

When I run this in On Tableau Online in Tableaus Custom SQL Query I get now Rows in the Response.
Tableau Custom SQL 从 Big Query 表返回 None。

I also checked it in the Tableau Prep Builder Application just to make sure it wasn't Tableau Online..

I have checked if the connection works by just running

SELECT * from `table-in-big-query`

And it does so I'm not sure where the Mismatch is...

答案1

得分: 0

感谢nbk提供了一个解决方案。

我不知道为什么这个方法有效,而之前的选项不行。

所使用的解决方案是:

SELECT * FROM (SELECT *, ROW_NUMBER() OVER(PARTITION BY unique_Field ORDER BY Upload_Datetime DESC)
AS temp_row_number
from `table-in-big-query` )
WHERE temp_row_number = 1
英文:

Thank you to nbk for providing a solution.

I do not have an answer as to why this works but the previous option didn't.

The solution used was:

SELECT * FROM (SELECT *, ROW_NUMBER() OVER(PARTITION BY unique_FieldORDER BY Upload_Datetime DESC)
AS temp_row_number
from `table-in-big-query` )
WHERE temp_row_number = 1

huangapple
  • 本文由 发表于 2023年7月3日 21:39:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605291.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定