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 2005 Forums
 Transact-SQL (2005)
 Copying information from one table to another

Author  Topic 

dartingaround
Starting Member

2 Posts

Posted - 2009-06-10 : 10:14:43
Hello SQL Guru's

I working on a project where I was given 2 tables. Table one is called assets and another table called jfsassets

There are 2 fields in assets called ASSETNO and USER1
There are 2 fields in jfsassets called ASSETNO and PONUMBER

I want to copy user1 information from assets table to the PONUMBER in the jfsassets table. The assetno in both tables are identical.

Any help would be appreciated.

Thanks
JB

asgast
Posting Yak Master

149 Posts

Posted - 2009-06-10 : 11:22:40
UPDATE jfassets
SET ponumber = a2.information
FROM jfassets a
INNER join assets a2 on a.assetno = a2.assetno
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-06-10 : 11:47:49
UPDATE j
SET PONUMBER = a.USER1
FROM jfassets as j
INNER join assets as a on a.ASSETNO = j.ASSETNO


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

dartingaround
Starting Member

2 Posts

Posted - 2009-06-10 : 16:04:37
Worked great guys... Thanks for your help!
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-06-10 : 16:07:55
welcome


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -