Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Update question

Author  Topic 

Gideon
Starting Member

15 Posts

Posted - 2002-08-19 : 00:10:27
Hi there,

I have a simple UPDATE question I can't get my head around.

I have Table1 with about 6000 rows....One column is called Manager and there are about 30 distinct manager's names.

I want to update this table to reflect a change of manager.

I have Table 2 that has 2 columns called Old_manager, New_manager...New_Manager is the name I want to update Table1 with....

I want to:update Table1
SET table 1.Manager = Table 2.New_manager
WHERE Table1.manager = Table2.Old_manager

HELP......I can't quite get the logic.....


Nazim
A custom title

1408 Posts

Posted - 2002-08-19 : 00:35:39

update T1
SET Manager = t2.New_manager
from table1 t1
inner join table2 t2
on t1.manager=t2.old_manager


-------------------------
What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson


Edited by - Nazim on 08/19/2002 02:08:02
Go to Top of Page
   

- Advertisement -