Hey all...first time to the site so excuse me for bein some what of a noob to how to properly ask questions.
Im looking to create a table which selects a cloumn from another table twice.
so i have a table of customers
Name Type
CUST_ID NUMBER
FIRSTNAME VARCHAR2(40)
and a table of calls
Name Type
CALLER_CUST_ID NUMBER(2)
CALLER_FIRSTNAM E VARCHAR2(40)
RECEIVER_CUST_I D NUMBER(2)
RECEIVER_FIRSTN AME VARCHAR2(40)
im looking to populate table calls with
CALLER_CUST_ID = CUST_ID, CALLER_FIRSTNAM E = FirstName
and
RECEIVER_CUST_I D = CUST_ID, RECEIVER_FIRSTN AME = FIRSTNAME.
the code ive been playing around with is
[code=oracle]
INSERT INTO calls (
caller_cust_ID , caller_firstnam e,receiver_cust _ID , receiver_firstn ame)
SELECT cust_ID , firstname, cust_ID , firstname FROM
(SELECT cust_ID , firstname, cust_ID , firstname FROM custumer
ORDER BY DBMS_RANDOM.VAL UE
)
WHERE ROWNUM = 1;[/code]
Im getting an Column Ambigiguosly Defined error
Im looking to create a table which selects a cloumn from another table twice.
so i have a table of customers
Name Type
CUST_ID NUMBER
FIRSTNAME VARCHAR2(40)
and a table of calls
Name Type
CALLER_CUST_ID NUMBER(2)
CALLER_FIRSTNAM E VARCHAR2(40)
RECEIVER_CUST_I D NUMBER(2)
RECEIVER_FIRSTN AME VARCHAR2(40)
im looking to populate table calls with
CALLER_CUST_ID = CUST_ID, CALLER_FIRSTNAM E = FirstName
and
RECEIVER_CUST_I D = CUST_ID, RECEIVER_FIRSTN AME = FIRSTNAME.
the code ive been playing around with is
[code=oracle]
INSERT INTO calls (
caller_cust_ID , caller_firstnam e,receiver_cust _ID , receiver_firstn ame)
SELECT cust_ID , firstname, cust_ID , firstname FROM
(SELECT cust_ID , firstname, cust_ID , firstname FROM custumer
ORDER BY DBMS_RANDOM.VAL UE
)
WHERE ROWNUM = 1;[/code]
Im getting an Column Ambigiguosly Defined error
Comment