Home » SQL & PL/SQL » SQL & PL/SQL » inserting data into single table from multiple tables
inserting data into single table from multiple tables [message #1698] Thu, 23 May 2002 09:46 Go to next message
ckr
Messages: 13
Registered: May 2002
Junior Member
hai,
i just want to know how to create single table from multiple tables.

i have two tables customers and orders related by cust_id. i used the following query.

create table custcopy2 as select cust_id,cust_name,order_num
from customers c,orders o
where c.cust_id=o.cust_id;

result....column ambigously defined.
Re: inserting data into single table from multiple tables [message #1699 is a reply to message #1698] Thu, 23 May 2002 11:41 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
1 create table empdet as (select
2 a.ename,a.sal,b.loc
3 from emp a, dept b
4* where a.deptno=b.deptno)
SQL> /

Table created.
******************************************************
create table custcopy2 as (select c.cust_id,c.cust_name,o.order_num
from customers c,orders o
where c.cust_id=o.cust_id);
Re: inserting data into single table from multiple tables [message #1740 is a reply to message #1698] Sat, 25 May 2002 07:30 Go to previous message
ram
Messages: 95
Registered: November 2000
Member
create table custcopy2 as select o.cust_id,cust_name,order_num
from customers c,orders o
where c.cust_id=o.cust_id;

you have omitted alias name for key field
Previous Topic: associated variables
Next Topic: Subquery
Goto Forum:
  


Current Time: Fri Apr 26 18:31:37 CDT 2024