Home » SQL & PL/SQL » SQL & PL/SQL » how to add to the right side of my table, the colums and data of 2 other tables . (Oracle 12c)
how to add to the right side of my table, the colums and data of 2 other tables . [message #662636] Mon, 08 May 2017 09:07 Go to next message
mpniel
Messages: 4
Registered: February 2007
Junior Member
Is it possible with a select statement, to add to the right side of table A , the colums and data of 2 other tables B and C .
Example:
table A: col1 (pk) , col2 -- 10 rows
table B: col3 (pk) , col4 -- 10 rows
table C: col5 (pk) , col6 -- 10 rows

Each table have all pk values that exist on the other 2 tables.

the result should be as follows:
table A: col1 (pk) , col 2 , col4, col6
Re: how to add to the right side of my table, the colums and data of 2 other tables . [message #662637 is a reply to message #662636] Mon, 08 May 2017 09:10 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
Sounds like a simple join, for example,
orclz>
orclz> select emp.ename,dept.dname from emp join dept on(emp.deptno=dept.deptno);

ENAME      DNAME
---------- --------------
CLARK      ACCOUNTING
KING       ACCOUNTING
MILLER     ACCOUNTING
JONES      RESEARCH
FORD       RESEARCH
ADAMS      RESEARCH
Re: how to add to the right side of my table, the colums and data of 2 other tables . [message #662638 is a reply to message #662636] Mon, 08 May 2017 09:12 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:
OraFAQ Forum Guide
How to use {code} tags and make your code easier to read
Re: how to add to the right side of my table, the colums and data of 2 other tables . [message #662639 is a reply to message #662637] Mon, 08 May 2017 09:28 Go to previous messageGo to next message
mpniel
Messages: 4
Registered: February 2007
Junior Member
There is a relation of "One to One" between the 3 tables.
Re: how to add to the right side of my table, the colums and data of 2 other tables . [message #662640 is a reply to message #662639] Mon, 08 May 2017 09:29 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
Er.... so what?

A JOIN is one of the most basic SQL operations. Do you know what it is?
Re: how to add to the right side of my table, the colums and data of 2 other tables . [message #662641 is a reply to message #662637] Mon, 08 May 2017 10:50 Go to previous message
mpniel
Messages: 4
Registered: February 2007
Junior Member
Great answer.
Thanks very much!.
Previous Topic: Adding missing values in external table
Next Topic: Dynamic array as SP input
Goto Forum:
  


Current Time: Wed Apr 24 11:28:20 CDT 2024