table WHERE 中的字段有多个值
table field in WHERE has multiple values
像这样的查询的正确查询是什么:
UPDATE table SET field1 WHERE field2 = val and field3 = val AND val AND val;
其中field3有多个值。非常感谢,希望您能理解:)
The SQL IN condition (sometimes called the IN operator) allows you to
easily test if an expression matches any value in a list of values. It
is used to help reduce the need for multiple OR conditions in a
SELECT, INSERT, UPDATE, or DELETE statement.
UPDATE table SET field1=newVal WHERE field2 = val and field3 In (val1, val2, val3);
UPDATE tableName SET fieldName = newFieldValue
WHERE field1 = val1 AND field2 = val2 AND (
field3 = val3 OR field3 = val4 OR field3 = val5
);
像这样的查询的正确查询是什么:
UPDATE table SET field1 WHERE field2 = val and field3 = val AND val AND val;
其中field3有多个值。非常感谢,希望您能理解:)
The SQL IN condition (sometimes called the IN operator) allows you to easily test if an expression matches any value in a list of values. It is used to help reduce the need for multiple OR conditions in a SELECT, INSERT, UPDATE, or DELETE statement.
UPDATE table SET field1=newVal WHERE field2 = val and field3 In (val1, val2, val3);
UPDATE tableName SET fieldName = newFieldValue
WHERE field1 = val1 AND field2 = val2 AND (
field3 = val3 OR field3 = val4 OR field3 = val5
);