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 |
|
youruseridistoxic
Yak Posting Veteran
65 Posts |
Posted - 2008-07-09 : 11:11:44
|
| If;select a.pname, a.pnum, b.pnum, c.D1id from dbo.project ainner join dbo.master bon a.pnum = b.pnuminner join dbo.Updates con b.D1id = c.D1idReturns to me the following;Old Name1 348 348 058839Old Name2 349 349 063562Old Name3 350 350 088827Old Name4 344 344 018313Old Name5 347 347 050216Old Name6 351 351 099626Old Name7 352 352 112506Old Name8 345 345 040797Old Name9 346 346 040797And the contents of dbo.Updates are;New Name1 058839New Name2 063562New Name3 088827New Name4 018313New Name5 050216New Name6 099626New Name7 112506New Name8 040797New Name9 040797Then how come;update dbo.projectset pname = a.Pnewnamefrom dbo.Updates ainner join dbo.master bon pnum = b.pnumwhere b.D1id = a.D1idand type = 'work'Returns this?New Name 348 348 058839New Name1 349 349 063562New Name 350 350 088827New Name1 344 344 018313New Name 347 347 050216New Name1 351 351 099626New Name 352 352 112506New Name1 345 345 040797New Name 346 346 040797Am I missing some other condition in the update statement? |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
|
|
youruseridistoxic
Yak Posting Veteran
65 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-09 : 11:47:08
|
quote: Originally posted by youruseridistoxic But aren't I updating dbo.project? Where would the additional join appear?quote: Originally posted by spirit1 i don't see you joining to dbo.project in your update.read this to understand the methodology for this:http://weblogs.sqlteam.com/mladenp/archive/2007/08/19/60292.aspx_______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out!
i think it should be this:-update pset p.pname = a.Pnewnamefrom dbo.project pinner join dbo.master bon p.pnum = b.pnuminner join dbo.Updates aon b.D1id = a.D1idand type = 'work' |
 |
|
|
youruseridistoxic
Yak Posting Veteran
65 Posts |
Posted - 2008-07-09 : 16:54:34
|
Works perfect. Thank you very much.quote: i think it should be this:-update pset p.pname = a.Pnewnamefrom dbo.project pinner join dbo.master bon p.pnum = b.pnuminner join dbo.Updates aon b.D1id = a.D1idand type = 'work'
|
 |
|
|
|
|
|