Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/66.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 选择,然后在同一列中更新_Sql - Fatal编程技术网

Sql 选择,然后在同一列中更新

Sql 选择,然后在同一列中更新,sql,Sql,我的数据库中有: | id | time | time-left | | 1 | 242363246 | 1 | | 2 | 215625252 | 1 | | 3 | 147852369 | 1 | | 4 | 951753456 | 1 | 我如何才能在剩余时间中插入与时

我的数据库中有:

| id           | time        | time-left   |
| 1            | 242363246   | 1           |
| 2            | 215625252   | 1           |
| 3            | 147852369   | 1           |
| 4            | 951753456   | 1           |
我如何才能在
剩余时间
中插入与
时间
中相同但又有111个的时间?我希望它变成这样:

| id           | time        | time-left   |
| 1            | 242363246   | 242363357   |
| 2            | 215625252   | 215625363   |
| 3            | 147852369   | 147852480   |
| 4            | 951753456   | 951753567   |

假设
time
是一个整数或可以递增的字符类型(使用隐式转换):

如果
time
不能以这种方式递增,则必须先将其转换为整数类型


根据您使用的数据库管理系统的不同,为无效名称使用带引号的标识符的方法(如本例中的
time left
)可能是使用括号:
[time left]
(SQL Server)或使用倒勾:
`time left`
(MySQL).

假设
时间
是一个整数或可以递增的字符类型(使用隐式转换):

如果
time
不能以这种方式递增,则必须先将其转换为整数类型


根据您使用的数据库管理系统的不同,对无效名称使用带引号的标识符(如本例中的
time left
)的方式可能是使用括号:
[time left]
(SQL Server)或使用倒勾:
`time left`
(MySQL)。

您使用的是什么RDBMS引擎?您使用的是什么RDBMS引擎?
update myTable set "time-left" = time + 111;
update MyTable
set time-left = time + 111
UPDATE your_table
SET "time-left" = time + 111;