Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对数据库有点新手,我将非常感谢提供的任何帮助。我需要在表格的一列中将所有单元格减少 X。我是否需要选择表和列并将值用作变量,例如$value=$value +/- X;
$value=$value +/- X;
那么只需这样做
UPDATE yourtablename SET columnname = columname-1
(如果您的列/单元格是整数类型,这可以正常工作)并且不要输入 WHERE CLAUSE(更新所有行)
试试这个,
UPDATE tableName SET colName = colName - 5 -- this will decrease the value by 5