[英]BigQuery Temp Table Column has no Name
I'm trying to create a temp table in BigQuery, something like:我正在尝试在 BigQuery 中创建一个临时表,例如:
CREATE TEMP TABLE myTmpTable AS
SELECT t.event_id, MAX(t.event_date)
FROM eventsTable t
WHERE t.field_name = "foo"
AND t.new_string = "bar"
GROUP BY t.event_id;
This results in error "CREATE TABLE columns must be named, but column 2 has no name".这会导致错误“必须命名 CREATE TABLE 列,但第 2 列没有名称”。 I understand that it can't extract a column name from MAX(t.event_date).我知道它无法从 MAX(t.event_date) 中提取列名。 Is there a way I can specify a column name?有没有办法可以指定列名?
Is there a way I can specify a column name?有没有办法可以指定列名?
Use below下面使用
SELECT t.event_id, MAX(t.event_date) AS max_event_date
Meantime the whole SELECT looks wrong to me - if you group by issue_id then event_id should be somehow aggregated.与此同时,整个 SELECT 在我看来是错误的 - 如果您按 issue_id 分组,那么 event_id 应该以某种方式聚合。 Or you might want to group by event_id instead!或者您可能想改为按 event_id 分组!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.