Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

A query to flaten, denormalize data.

s_dot1985Aug 24 2009 — edited Aug 25 2009
Hi,

I'm not too sure whats the best way to go about this query. Hopefully somebody can point me in the right direction.

I have two tables Person & Contact_No.

Person:

PersonID
Name

Sample Data:
1 John
2 Mary
3 Jeff
4 Ann
etc

Contact_No:

PersonID
Contact_Type
Number

Sample Data:
1 Cell 12345678
1 Home 98765432
1 Cell2 12458788
2 Home 23245453
3 Cell 11233434
3 Home 12546342
3 Home2 65445645

There is a set number of types; Cell, Cell2, Home, Home2.

The reltationship between the tables is One Person to ZeroMany Contact_No.

The query i want to run will have the following columns:

PersonID___Cell____Cell2____Home___Home2
1_________456456________45646_________
2_______________________987897________
3_________454210________132131__231300
4_____________________________________

The query should return all persons no matter if they have a contact no or not. The columns will contain all the 4 types.

Any ideas?

Thanks,
Sean
This post has been answered by Frank Kulash on Aug 24 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 22 2009
Added on Aug 24 2009
5 comments
3,433 views