Tuesday, March 20, 2012

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.

Billinsert 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

No comments:

Post a Comment