kevorski
kevorski

Reputation: 836

Updating multiple SQL records from x to x in a single query

I have 30+ records that need to be updated to have some of the same billing information. I don't want to have to type in every single number from 1200-1237. Is there an easy way to update all these records without copy/paste and altering the numbers? Possibly use a count?

EX:

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

Upvotes: 0

Views: 20

Answers (1)

Serg
Serg

Reputation: 22811

Provided EN_ID is numeric

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

Upvotes: 1

Related Questions