Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > Database & Database Programming

Vote on your favorite hash algorithm here!

Database & Database Programming MySQL, Oracle, SQL, PL/SQL, ABAP, Smart Forms, and other databases and languages. A database is an organized body of related information used in many websites (including CC).

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-21-2008, 01:55 AM
Caspersky12 Caspersky12 is offline
Newbie
 
Join Date: Feb 2008
Posts: 6
Credits: 0
Rep Power: 0
Caspersky12 is on a distinguished road
Default SQL insert and update

Is there any1 can help me to my lines
ex...

Table 1
Acct_Num Name
123456 Mhel
123465 Jhen

Table2
Acct_Num Name
123456 Mhel
125555 Jenny
133455 Led

I want to insert the record not listed in the Table 1 e.g(125555, Jenny and 133455, Led) but, the problem is Table 2 has an existing record from Table1...

Insert into Table1(Acct_Num, Name) Select Acct_Num,Name from Table2 where not exists(Select Acct_Num, Name from Table1)

tnx, i highly appreciated those who want to give some help...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 02-21-2008, 02:09 PM
Jordan's Avatar   
Jordan Jordan is online now
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 7,399
Last Blog:
Tramp Variables
Credits: 1
Rep Power: 20
Jordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud ofJordan has much to be proud of
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan
Default

I don't understand what you are asking. From what I see you are trying to insert 125555 and Jenny but a record already exists? You can use "delete" to remove the record:

Code:
DELETE FROM tb1 WHERE Acct_Num="125555";
And then run your insert command. Not sure what you are trying to do though.
__________________
CodeCall Blog | CodeCall Wiki | Shareware Site | Linux Forum | Write a Blog
Don't hesitate to ask any questions that you have! Check out our ASCII Calculator!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Tutorials Jordan Database & Database Programming 7 02-23-2008 03:20 AM
Jdbc evronia Java Help 1 11-24-2007 02:03 AM


All times are GMT -5. The time now is 08:56 AM.

Contest Stats

Xav ........ 1357.94
MeTh0Dz|Reb0rn ........ 1083.85
WingedPanther ........ 919.18
marwex89 ........ 906.86
morefood2001 ........ 903.18
John ........ 902.37
Brandon W ........ 789.89
chili5 ........ 312.39
Steve.L ........ 264.99
dcs ........ 240.34

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 83%

Ads