SQL Language (MOSC)

MOSC Banner

UNION of 2 tables with precedence

edited Dec 11, 2019 2:42AM in SQL Language (MOSC) 5 commentsAnswered ✓

I have two tables, each with a column  'ID'

PAE has ID populated with

1

2

3

4

5

6

7

8

LAE has ID populated with

1

5

8

I am looking for a select statement that unions PAE and LAE together

with a distinct listing of 1 through 8, but adds a column 'REPRESENTS'

that shows where the row is coming from, with the LAE table having

precedence.   I'm looking for the answer to be:

1 PAE

2 LAE

3 LAE

4 LAE

5 PAE

6 LAE

7 LAE

8 PAE

Can anyone help with the SQL statement? I've simplified my problem, but

for some reason am having a mental block about this.

Sherrie

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