根据文档here,我应该能够将表通配符函数作为别名引用:
...
FROM
[project_name:]datasetId.tableId |
(subselect_clause) |
table wildcard function
[[AS] alias]
...
但是,当我尝试这样做时,事情就失败了:
bq query "SELECT * FROM TABLE_QUERY(my_data, \"TIMESTAMP(table_id) BETWEEN TIMESTAMP('2014-05-21') AND TIMESTAMP('2014-06-10')\") AS blah WHERE blah.foo = 5 LIMIT 30"
Waiting on bqjob_some_id ... (0s) Current status: DONE
BigQuery error in query operation: Error processing job 'some_id': Field 'blah.foo' not found in table 'mydata.20140521'; did you mean 'foo2'?
我想对通配符函数返回的数据进行连接,将其视为单个表,因此对它进行别名对我来说非常重要。想法?
答案 0 :(得分:3)
您链接的页面确实提到“不要将别名与表格通配符功能一起使用。”
您可能想尝试
SELECT *
FROM (SELECT * FROM TABLE_QUERY(--insert query here--)) AS blah
WHERE blah.foo = 5 LIMIT 30"