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 |
|
dr223
Constraint Violating Yak Guru
444 Posts |
Posted - 2010-05-27 : 08:12:21
|
| Hi, I have two tables tblA and tblB. tblA has 4 fields Name Address1Address2Town (this field I have just created and it is NULL for all records)tblB has 4 fieldsName Address1Address2TownI want to write a query where if the Name in tblA is the same as Name in tblB. Town field is populated with respective data from tblB.Thanks |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-27 : 08:30:44
|
If more than one person are having the same name then this update is dangerous - you know?update aset Town=b.townfrom tableA as ajoin tableB as b on a.name=b.name No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
dr223
Constraint Violating Yak Guru
444 Posts |
Posted - 2010-05-27 : 11:59:03
|
| Thanks worked fine |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-27 : 12:58:20
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|