mysql - WHERE 中的表字段有多个值

标签 mysql where-clause

对于这样的事情正确的查询是什么:

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);

关于mysql - WHERE 中的表字段有多个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45776135/

相关文章:

php - 防止 Laravel 中的用户帐户同时提款

java.lang.AbstractMethodError : com. mysql.jdbc.PreparedStatement.setBlob(ILjava/io/InputStream;)V

C# 泛型 : Inserting T as the where T : IComparable<T> interface conflict

sql - 用于提取 SQL where 子句的正则表达式

mysql - 使用 WHERE 子句优化 DELETE FROM

MySQL UNION 返回不存在的 id

java - JPA在MySQL数据库中保存错误的日期

mysql - 如何在 mysql 准备好的语句中正确使用 WHERE LIKE?

SQL:任何类型的联接都可以重写为一组 WHERE 条件吗?

Mysql查询检查where子句中的blob列类型