SQL Language (MOSC)

MOSC Banner

same alias more than once in select

edited Sep 6, 2018 5:18AM in SQL Language (MOSC) 2 commentsAnswered

Hi,

What do you think about this query? The 2nd, 3rd and 4th dataset have same alias (B) :

select A.id, B.DATA from

  (select level id, 'a' data from dual connect by level <= 2) A

  inner join (select level id, 'B' data from dual connect by level <= 2) B on (B.id = A.Id) --B1

  inner join (select level id, 'C' data from dual connect by level <= 2) B on (B.id = A.Id) --B2

  inner join (select level id, 'D' data from dual connect by level <= 2) B on (B.id = A.Id) --B3

;

--the result is:

1 B

2 B

"B.DATA" in the result means the DATA column of the "first B" alias. The result contains 2 records, so the "

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center