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 |
|
jamie
Aged Yak Warrior
542 Posts |
Posted - 2004-07-01 : 08:33:34
|
| hello,I have a problem with an update query.when I run :Select contact.name, company.namefrom contactinner join company on company.id=contact.companyidwhere company = 'test'I am displayed 3 rows.when I run :UPDATE contactSET contact.name = company.namefrom contactinner join company on company.id=contact.companyidwhere company = 'test'I only update 1 row.how can I update all the rows ?what am I doing wrong here ?nice one guys,Jamie |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-07-01 : 09:23:15
|
| You probably have 3 rows in company, but only one match in contact.-------Moo. :) |
 |
|
|
sujeetnatarajan
Starting Member
1 Post |
Posted - 2004-07-02 : 07:04:58
|
quote: Originally posted by jamie hello,I have a problem with an update query.when I run :Select contact.name, company.namefrom contactinner join company on company.id=contact.companyidwhere company = 'test'I am displayed 3 rows.when I run :UPDATE contactSET contact.name = company.namefrom contactinner join company on company.id=contact.companyidwhere company = 'test'I only update 1 row.how can I update all the rows ?what am I doing wrong here ?nice one guys,Jamie
hi frndtry thisUPDATE contactSET contact.name = company.namefrom contactinner join company on company.id=contact.companyidwhere company like '%test%' |
 |
|
|
jamie
Aged Yak Warrior
542 Posts |
Posted - 2004-07-02 : 07:19:58
|
| hi,I think the problem is what mr mist has suggested.I need to rewrite my query to only display the one related value, instead of all company values.thanks |
 |
|
|
|
|
|