I have to update one table field as another field of different table in sql. There are two tables, create_account and Trans_Details. I have to update amount field of create_account table and set it into current_balance of Trans_Details table. How can I join these two tables? please write a query for this.
Asked
Active
Viewed 105 times
-1
-
[this ?](http://stackoverflow.com/questions/1604091/update-a-table-using-join-in-sql-server) – Flakes May 09 '13 at 07:20
1 Answers
0
You can utilize the sub queries to do this...
Example:
I do not know what kind of data base r u using i am just giving a pseudo code..
UPDATE create_account SET (amount) = ( SELECT current_balance FROM Trans_Details
WHERE filter = some_value) WHERE filter = some_value.
I have added the where clause in the query, please ignore if u want to update the entire row in the column amount.

Bala Varadarajan
- 514
- 1
- 5
- 17
-
UPDATE create_account1 SET create_account1.amount = Trans_Details.Current_Balance FROM create_account1 INNER JOIN Trans_Details ON create_account1.maccountno = Trans_Details.DAccNo . Is it correct? – user2365210 May 09 '13 at 09:13