If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Comparing

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-07-03, 14:48
bwood415 bwood415 is offline
Registered User
 
Join Date: Oct 2003
Posts: 42
Red face Comparing

Seeing as I am not the best with SQL and I was having a big time trouble with this I thought I would come here for some help. I have two tables with names in both two columns and want to update one table with the names of any new names in the other table. I have tried the following code and many versions of such.

Please help. and yes this is not the best SQL code and thats why I came here.

Insert Into 2003(Name)SELECT User_Name FROM Qry WHERE (Name FROM 2003)<>(User_Name From Qry)

Also used the same code cept for UPDATE where Insert Into, and also changed Where statement to a couple other things.

Thank you for your time.

Bill
Reply With Quote
  #2 (permalink)  
Old 11-07-03, 16:51
mkkmg mkkmg is offline
Registered User
 
Join Date: Oct 2003
Location: Dallas
Posts: 76
...try something like this

insert into [2003] (name)

select q.user_name
from qry q, [2003] t
where t.name <> q.user_name


----------------------------------------

update t
set t.name = q.username
from [2003] t, qry q
where t.name <> q.user_name
Reply With Quote
Reply

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On