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 query problem.

Author  Topic 

patshaw
Posting Yak Master

177 Posts

Posted - 2006-05-16 : 10:15:06
I have a table (Table1) that has many columns including PhoneNumber and product. I have a second table (Table2) that has just 2 columns named PhoneNumber and product. I need to write a query that will update Table1.products with the values from Table2.Products where the PhoneNumbers match. How can this be done?

Kristen
Test

22859 Posts

Posted - 2006-05-16 : 10:23:19
[code]
UPDATE T1
SET products = T2.Products
FROM Table1 AS T1
JOIN Table2 AS T2
ON T2.PhoneNumber = T1.PhoneNumber
[/code]
Kristen
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-16 : 10:24:00
Update t1 Set products = t2.products From Table1 t1
inner join Table2 t2 on
t1.phoneno = t2.phoneno

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-16 : 10:24:57
41 secs

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-05-16 : 10:29:43
And I remembered the "=" this time!
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-16 : 10:30:50
quote:
Originally posted by Kristen

And I remembered the "=" this time!




If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

patshaw
Posting Yak Master

177 Posts

Posted - 2006-05-16 : 10:44:52
Thanks Guys
Go to Top of Page
   

- Advertisement -