I have a table t1(id)
and table t2(did, ddept, dname)
. I want to insert in table
t3(id
from t1
and did,ddept,dname
from t2)
. I am totally stuck at this and need some help.
Asked
Active
Viewed 1,187 times
0

Alex Poole
- 183,384
- 11
- 179
- 318

user1815823
- 617
- 2
- 8
- 14
-
is there a relation between t1 and t2 tables? – Jasti Jul 26 '13 at 17:13
-
No relation beteen t1 and t2 – user1815823 Jul 26 '13 at 17:57
1 Answers
1
Insert into t3 (Select t1.id, t2.did, t2.ddept, d2.dname from t1 cross join t2)
However, without knowing how t1 and t2 relate, you'll get a Cartesian result. Also assumes column order in T3 is the T1.ID, t2.did, t2.ddept, and d.name...
Previous post found :INSERT SELECT statement in Oracle 11G shows how to do the proper formatting if orders don't match.