这是我需要转换为Update的Select查询语句:
SELECT DISTINCT f.SectionID, f.Name, v.Enabled
FROM SETTING_VALUE v
INNER JOIN SETTING s ON v.SettingID = s.SettingID
INNER JOIN LU_FIELD f ON f.FieldID = s.FieldID
WHERE v.DisplayValue LIKE '%Miami%'
AND f.ControlName LIKE '%City%'
My attempt:
UPDATE SETTING_VALUE
SET Enabled = 0
FROM SETTING_VALUE v
INNER JOIN SETTING s ON v.SettingID = s.SettingID
INNER JOIN LU_FIELD f ON f.FieldID = s.FieldID
WHERE v.DisplayValue LIKE '%Miami%'
AND f.ControlName LIKE '%City%'
不确定如何应用Distinct
SELECT
查看数据的工作做得很好。但我不知道为什么你想使用DISTINCT
投影。所有匹配的行都应该被更新,使用DISTINCT
似乎没有逻辑上的意义。 - Yuck