我想更新表标题columns_header其中字段等于"c02_Emissions"并且field_base"VEHICLE"或"VEHICLE_FP"。我当前的脚本更新所有"车辆"和"VEHICLE_FP"记录,并且不关心字段 ="c02_Emissions"。这不是我想要的。我可以得到一些关于如何正确操作的帮助吗?
UPDATE headers
SET columns_header = 'CO2 Emissions'
WHERE field = 'c02_Emissions'
AND field_base = 'VEHICLE'
OR field_base = 'VEHICLE_FP';
在梳理 AND 和 OR 时,应始终使用括号:
UPDATE headers
SET columns_header = 'CO2 Emissions'
WHERE field = 'c02_Emissions'
AND (field_base = 'VEHICLE'
OR field_base = 'VEHICLE_FP');
你也可以试试这个
UPDATE headers
SET columns_header = 'CO2 Emissions'
WHERE field = 'c02_Emissions'
AND field_base IN ( 'VEHICLE','VEHICLE_FP');