0

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.

Alex Poole
  • 173,063
  • 10
  • 166
  • 288
user1815823
  • 587
  • 2
  • 7
  • 14

1 Answers1

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.

Community
  • 1
  • 1
xQbert
  • 33,725
  • 2
  • 39
  • 60