根据同一 table 中的其他列更新多个列
Update multiple columns based on other columns in same table
我正在尝试根据其他两列更新两列某些值,并在同一列中使用某些值 table,但他们一直想出一个叫做绑定的东西。
这是行不通的:
UPDATE table t1
SET t1.column1 = value1, t1.column2 = value2
WHERE t1.column5 = cake
AND t1.column7 = pie;
我假设您收到 "invalid identifier" 错误,如果我的假设是正确的,那么您的代码中唯一可能的错误是您忘记将您的值包含在单引号中。
UPDATE table t1
SET t1.column1 = value1, t1.column2 = value2
WHERE t1.column5 = 'cake'
AND t1.column7 = 'pie';
Note that if you are assigning/comparing a value with a datatype string, you should always enclose it with single-qoutation marks
.
我正在尝试根据其他两列更新两列某些值,并在同一列中使用某些值 table,但他们一直想出一个叫做绑定的东西。
这是行不通的:
UPDATE table t1
SET t1.column1 = value1, t1.column2 = value2
WHERE t1.column5 = cake
AND t1.column7 = pie;
我假设您收到 "invalid identifier" 错误,如果我的假设是正确的,那么您的代码中唯一可能的错误是您忘记将您的值包含在单引号中。
UPDATE table t1
SET t1.column1 = value1, t1.column2 = value2
WHERE t1.column5 = 'cake'
AND t1.column7 = 'pie';
Note that if you are assigning/comparing a value with a datatype string, you should always enclose it with
single-qoutation marks
.