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
 SQL Server Development (2000)
 HOW TO UPDATE DATA BETWEEN DIFFERENT TABLES

Author  Topic 

DURGESH
Posting Yak Master

105 Posts

Posted - 2008-06-12 : 01:13:26
Hello all
Gud Morning

i have two table
tableA
id,v1,v2,v3,v4,v5 are the columns

tableB
id,Values are the columns

id Value
1 value1
1 value2
1 value3
1 value4
1 value5
now i want to update the values of col Value of tableB to tableA
and i want the output of tableA as

id v1 v2 v3 v4 v5
1 value1 value2 value3 value4 value5

can anybody help me to solve the issue using update query

thanks in advance

YES I HAVE MORE 10 FIELDS BUT I AM INSERTING ALL THOSE FIELS USING INSERT QUERY

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 01:52:25
Is there any other fields available in your tableB?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-12 : 02:07:01
Can you provide some sample data from you table (may be for a single ID)
Go to Top of Page

mayoorsubbu
Yak Posting Veteran

95 Posts

Posted - 2008-06-12 : 23:43:22
Durgesh,

Try this

Update tableA set value1 = (select Value1 from tableb where tableA.id = tableB.id) ,
value2 = (select Value2 from tableb where tableA.id = tableB.id) ,
value3 = (select Value3 from tableb where tableA.id = tableB.id);
Go to Top of Page
   

- Advertisement -