Home » SQL & PL/SQL » SQL & PL/SQL » copying a column from one table to other table (9.0.4.0)
copying a column from one table to other table [message #310731] Wed, 02 April 2008 04:20 Go to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

Hi ,

I have 2 tables called 'A' and 'B'.In 'A' I have 10 columns and in B i have 5 columns.
Now I want to copy 2nd columns records in A into 2nd column in 'B' both columns have the same datatype.Now I need to copy the total column from A into B.
Could you please give me idea for this..

Thank you
Re: copying a column from one table to other table [message #310736 is a reply to message #310731] Wed, 02 April 2008 04:31 Go to previous messageGo to next message
Michel Cadot
Messages: 65144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is a basic SQL question and has nothing to do in Precompiler forum.
Don't randomly put your questions.

Regards
Michel
Re: copying a column from one table to other table [message #310740 is a reply to message #310736] Wed, 02 April 2008 04:39 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member

Michel,

Here I wrote the query:

INSERT INTO A(A1,A3,A7,A8,A9)
SELECT B1,B2,B3,B4,B5 FROM B;
or
INSERT INTO B( B1,B2,B3,B4,B5)
SELECT B5A1,A3,A7,A8,A9 FROM A;

...
but the requirement is if there is record in table "A" it should be copied into table "B" based on some condition.
for example take EMP and DEPT tables..

Thank you.
Re: copying a column from one table to other table [message #310747 is a reply to message #310740] Wed, 02 April 2008 04:53 Go to previous message
Michel Cadot
Messages: 65144
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Add your conditions.

And format your post.

Regards
Michel

[Updated on: Wed, 02 April 2008 04:53]

Report message to a moderator

Previous Topic: Error ORA-01652 while running select query
Next Topic: ORA-00904: invalid identifier error with Foreign Keys
Goto Forum:
  


Current Time: Sat Aug 19 17:37:29 CDT 2017

Total time taken to generate the page: 0.11480 seconds