nirnroot
nirnroot

Reputation: 724

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. 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. Maybe it's just some regular SQL syntax that I've never seen before. Please enlighten me?

Upvotes: 0

Views: 60

Answers (1)

MT0
MT0

Reputation: 167822

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.

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

Upvotes: 1

Related Questions