在单个查询中将多个SQL记录从x更新为x

时间:2017-11-01 18:29:30

标签: sql sql-update

我有30多条记录需要更新以获得一些相同的结算信息。我不想输入1200-1237的每个号码。有没有一种简单的方法来更新所有这些记录而无需复制/粘贴和更改数字?可能使用计数?

EX:

UPDATE LakeEncroachments
SET PERMITEE = 3304, BILLTOPERSON = 3304, 
    LakeEncroachments.InvoiceBillTo = 1799 
WHERE LakeEncroachments.EN_ID = 1200, LakeEncroachments.EN_ID = 1201, LakeEncroachments.EN_ID = 12xx

1 个答案:

答案 0 :(得分:1)

提供的EN_ID是数字

UPDATE LakeEncroachments
SET 
   PERMITEE = 3304, BILLTOPERSON = 3304, LakeEncroachments.InvoiceBillTo = 1799 
WHERE 
   LakeEncroachments.EN_ID BETWEEN 1200 AND 12037