Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google bigquery Bigquery:如何从where子句中选择多个列_Google Bigquery - Fatal编程技术网

Google bigquery Bigquery:如何从where子句中选择多个列

Google bigquery Bigquery:如何从where子句中选择多个列,google-bigquery,Google Bigquery,我在BigQuery中做了类似的事情: SELECT user_id, title, time FROM abc where (user_id, time) IN (select user_id, max(time) from abc group by user_id) 但我得到了这个错误: '输入类型的子查询必须只有一个输出列' 我们如何在BigQuery中

我在BigQuery中做了类似的事情:

SELECT
    user_id,
    title,
    time
FROM
    abc
where (user_id, time) IN (select user_id, max(time)
                          from abc
                          group by user_id)
但我得到了这个错误: '输入类型的子查询必须只有一个输出列'

我们如何在BigQuery中做到这一点?请提前感谢。

以下内容将起作用(注意将
添加为struct

同时,下面是一个更大的质疑方式

select as value
  array_agg(t order by time desc limit 1)[offset(0)]
from abc t
group by user_id

谢谢,米哈伊尔,这很有效。您能解释一下这个结构作为select查询的一部分做了什么吗?这个“额外”结构-使select类型的结果与同样是结构的
(用户id,时间)
兼容。如果YO将只有一个COLL作为<代码>,其中UsRyID在(…<代码>中,在这种情况下,您只需要一个COLL在SELECT列表中,而不需要StReTo: O)考虑投票,接受如果答案帮助:O)
select as value
  array_agg(t order by time desc limit 1)[offset(0)]
from abc t
group by user_id