所以我想做一个"更新"到域中的任何项目[FirstItem +5或 - 5] 例如:
我有一张像这样的表:462 458 768 466
更新后,它将像:
462 462 768 462
,因为:
458
和466
包含在域中
[457.458.459.460.461(462)463.464.465.466.467]
我希望我很清楚
答案 0 :(得分:0)
如果您的SQL支持WITH命令, 你可能会做以下事情:
WITH MyItem(fItem) AS (SELECT first(item) as fItem FROM TableName)
Update TableName SET Item = fItem
WHERE Item Between fItem-5 AND fItem+5
如果第一个命令不存在,请尝试
WITH MyItem(fItem) AS (SELECT TOP 1 item as fItem FROM TableName)
Update TableName SET Item = fItem
WHERE Item Between fItem-5 AND fItem+5