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 |
|
batcater98
Starting Member
22 Posts |
Posted - 2009-01-21 : 13:58:25
|
| I am trying to update a field in a table based on the successful match to another table in a join. But it is simply updating every row - which I know is not true. What am I doing wrong.Here is what I have now.UPDATE event_dataSET Is_Source = 'Y', DN_Source =FROM event_data INNER JOIN event_data_details ON event_data.DN_Source = event_data_details.DN_SourceWhat I want is for every match of event_data.dn_source to event_data_details.dn_source I want to put a character Y in the is_source field of event_data table.Thanks,ad.Regards,The Dark Knight-Give What is Right, Not What is Left- |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-21 : 14:02:54
|
UPDATE tSET t.Is_Source = 'Y'FROM event_data tINNER JOIN event_data_details mON t.DN_Source = m.DN_Source |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-21 : 14:03:59
|
| i dont think there's any problem with query. it will only update those records where event_data.DN_Source = event_data_details.DN_Source holds true |
 |
|
|
batcater98
Starting Member
22 Posts |
Posted - 2009-01-21 : 14:11:54
|
| Thank you - that worked perfectly!Regards,The Dark Knight-Give What is Right, Not What is Left- |
 |
|
|
|
|
|