SQL Language (MOSC)

MOSC Banner

What would be your approach to aggregate two tables with all relationship types (1-1, 1-M, M-1, M-M,

edited Jan 17, 2017 10:58AM in SQL Language (MOSC) 5 commentsAnswered ✓

Simple question for you SQL experts!

I have two tables (Budget and Actual) that I want to aggregate into one.  The records' relationship is: 1-1, M-1, 1-M, M-M, 0-1, and 1-0.

Below is an example.  How would you merge the data ?  Join, Union?

 

Budget Table

Actual Table

Dept

Hrs

Dept

Hrs

A 1A 1
B 1B 2
B 1C 1
C 2C 1
D 1D 1
D 2D 1
E 1F1

Total

9

Total

8

I need the results to be like below (single table/output):

 

Dept

Budget

Actuals

A11
B22
C22
D32
E10
F01

Total

9

8

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