Home » SQL & PL/SQL » SQL & PL/SQL » Insert into table
Insert into table [message #256790] Mon, 06 August 2007 12:57 Go to next message
lamnguyen14
Messages: 119
Registered: March 2007
Location: Virginia
Senior Member
Hi all.

Please help me with this. I have three tables: A, B and C.

And I have to insert into table A the rows that are in either of the table B or table C but not currently in table A.

Please show me the way to do this.
Thank you for you time and we look forward to your response.
Re: Insert into table [message #256798 is a reply to message #256790] Mon, 06 August 2007 13:28 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can use "union all" and "minus".

Regards
Michel
Re: Insert into table [message #256805 is a reply to message #256798] Mon, 06 August 2007 13:42 Go to previous messageGo to next message
lamnguyen14
Messages: 119
Registered: March 2007
Location: Virginia
Senior Member
Thanks much.

But I am not really sure which tables should I use 'union all' and which tables should I use 'minus'.

Would you please to tell me a little more details. I would appreciate that.

Re: Insert into table [message #256807 is a reply to message #256805] Mon, 06 August 2007 13:49 Go to previous messageGo to next message
Michel Cadot
Messages: 64151
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
This is in your text, you want to insert:
- the union of table B and table C
- minus what's inside table A.

You said it.

Regards
Michel
Re: Insert into table [message #256811 is a reply to message #256807] Mon, 06 August 2007 14:01 Go to previous message
lamnguyen14
Messages: 119
Registered: March 2007
Location: Virginia
Senior Member
Thank you very much.
Previous Topic: Masking fixed length flat file
Next Topic: Calling parametarized procedure in unix shell scripts
Goto Forum:
  


Current Time: Fri Dec 09 17:10:26 CST 2016

Total time taken to generate the page: 0.36254 seconds