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

Author  Topic 

dewacorp.alliances

452 Posts

Posted - 2003-04-16 : 18:50:39
Hi there

I had 2 tables whihc have a strcutrue similar like this:

Table 1:
ChargeCode, VARCHAR(8)
AccNo, VARCHAR(5)
BudgetJuly MONEY
BudgetAugust MONEY
BudgetDecember MONEY
BudgetPriorYear MONEY

Table 2:
ChargeCode, VARCHAR(8)
AccNo, VARCHAR(5)
BudgetPriorYear MONEY

I want to update the BudgetPriorYear on "TABLE 1" using the data of BudgetPriorYear of "TABLE 2" and this based on ChargeCode AND AccNO of these 2 tables.

Any help that will be great.

Thanks.



SamC
White Water Yakist

3467 Posts

Posted - 2003-04-16 : 19:31:36
UPDATE A
SET A.BudgetPriorYear = B.BudgetPriorYear
FROM Table1 A
INNER JOIN Table2 B
on B.ChargeCode=A.ChargeCode and B.AccNo=A.AccNo

I haven't tried it. Let me know if it works.

Sam


Go to Top of Page
   

- Advertisement -