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 |
|
rlull
Starting Member
39 Posts |
Posted - 2011-08-23 : 10:58:12
|
| Here is the Select I need to convert to an Update:SELECT DISTINCT f.SectionID, f.Name, v.EnabledFROM SETTING_VALUE v INNER JOIN SETTING s ON v.SettingID = s.SettingID INNER JOIN LU_FIELD f ON f.FieldID = s.FieldIDWHERE v.DisplayValue LIKE '%Miami%'AND f.ControlName LIKE '%City%'My attempt:UPDATE SETTING_VALUESET Enabled = 0FROM SETTING_VALUE v INNER JOIN SETTING s ON v.SettingID = s.SettingID INNER JOIN LU_FIELD f ON f.FieldID = s.FieldIDWHERE v.DisplayValue LIKE '%Miami%'AND f.ControlName LIKE '%City%'Not sure how to apply Distinct |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 11:17:46
|
| you mean you need to set enabled= 0 to only one record out of every f.SectionID, f.Name, v.Enabled group? what meaning does it make? also if you need to implement that, whats the rule to select single record?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
rlull
Starting Member
39 Posts |
Posted - 2011-08-23 : 11:28:26
|
| I think I made a mistake - all matching rows need to be updated. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 11:31:23
|
| then its exactly same as query you posted------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|