英文:
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.
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论