简体   繁体   English

这个 oracle SQL 语法是什么意思?

[英]What does this oracle SQL syntax mean?

I'm trying to get Power BI to import some oracle SQL data, but it seems I have to modernize some of it's syntax.我试图让 Power BI 导入一些 oracle SQL 数据,但似乎我必须对其某些语法进行现代化改造。 I can't seem to figure out what this means:我似乎无法弄清楚这意味着什么:

(
    (  SELECT 
           t1.column1
       FROM 
           table1 t1
       WHERE 
           t1.column3 = something
    )
    +
    (  SELECT 
           t2.column2 
       FROM 
           table2 t2
       WHERE 
           t2.column3 = somethingelse
    )
) AS name

It's the +-sign in the middle that throws me.是中间的 + 号让我感到震惊。 I've already learned that there's an old syntax for OUTER JOIN that uses a WHERE-clause with (+)-symbol to denote left/right, but this doesn't follow the syntax as there's no WHERE-clause.我已经了解到 OUTER JOIN 有一种旧语法,它使用带 (+) 符号的 WHERE 子句来表示左/右,但这不遵循语法,因为没有 WHERE 子句。 Maybe it's just some regular SQL syntax that I've never seen before.也许这只是一些我以前从未见过的常规 SQL 语法。 Please enlighten me?请赐教?

As @astentx stated in his comment , (SELECT... FROM...) is a scalar sub-query and the + operator is adding the numeric values that are returned from the sub-queries.正如@astentx 在他的评论中所述(SELECT... FROM...)是一个标量子查询, +运算符正在添加从子查询返回的数值。

You could equally have written it as:你同样可以把它写成:

( SELECT t1.column1 + 
  FROM   table1 t1
         CROSS JOIN t2.column2 
  WHERE  t1.column3 = something
  AND    t2.column3 = somethingelse
) AS name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM