子查询

时间:2020-06-02 15:33:44

标签: presto

SELECT
  id,(select something
   from table2 
   where table2.id = table.id) AS "Description"
 FROM table

我收到此错误:

presto error: Scalar sub-query has returned multiple rows

如何在presto中编写子查询?

1 个答案:

答案 0 :(得分:1)

Presto确实支持嵌套查询。我认为问题在于您的语义。

您正在尝试从嵌套查询中投射某些内容,并且期望标量值。

可能是这样-

select
id, desc from 
(select table.id as id, something as desc
    from table2 
    where table2.id = table.id)
相关问题