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.
Author |
Topic |
drpkrupa
Yak Posting Veteran
74 Posts |
Posted - 2006-05-11 : 13:28:21
|
I have two table called Table A and Table BTable A (Columns - ID, Last , First)Table B (Columbs - ID, Last, First, Address)Data into tablesTable A1 , , 2, ,3, ,Table B1,AA,BB,6792,BB,CC,5003,LL,MM,600I would like to write update query to update table A with last name and first name column fill from Table B when TableA.ID = TableB.IDHow can i write update query to fill table A from getting data from TableBI need result for Table A1,AA,BB2,BB,CC3,LL,MMThanks, |
|
Kristen
Test
22859 Posts |
Posted - 2006-05-11 : 13:45:48
|
[code]UPDATE ASET Last = B.Last, First = B.FirstFROM dbo.TableA AS A JOIN dbo.TableB AS B ON B.ID = A.ID[/code]Kristen |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-11 : 13:48:16
|
[code]Update TableASet Last = b.Last, First= b.Firstfrom TableA a inner join TableB b on a.ID= b.ID[/code]Edit :I'm a bit late than KristenAlso, there are examples similar to this if u search for UPDATE in Books ONline (SQL Server Help)Srinika |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-05-12 : 02:15:33
|
As in Kristen's query use Alias name after keyword UpdateMadhivananFailing to plan is Planning to fail |
|
|
|
|
|
|
|