MOG
MOG

Reputation: 29

Adding a number to all the values in a column of a mysql database with SQL

 identifier  rfidTag  hardware  firmware  manufacturingDate
        532   140532         1        21  2014-09-18 10:43:52
        533   140533         1        21  2014-09-18 10:49:34
        534   140534         1        21  2014-09-18 10:53:59
        535   140535         1        21  2014-09-18 11:21:52
        536   140536         1        21  2014-09-18 11:25:57
        537   140537         1        21  2014-09-18 11:29:57
        538   140538         1        21  2014-09-18 11:37:01
        539   140539         1        21  2014-09-18 11:45:01
        540   140540         1        21  2014-09-18 11:53:21
        541   140541         1        21  2014-09-18 12:00:00
        542   140542         1        21  2014-09-18 12:04:14
        543   140543         1        21  2014-09-18 12:09:25
        544   140544         1        21  2014-09-18 12:13:34
        545   140545         1        21  2014-09-18 12:17:56
        546   140546         1        21  2014-09-18 12:24:03

I have a mysql database with a table called shipmentdetailstable containing a column called rfidTag. My problem is that every value in the rfidTag column should be the value displayed plus 30. So for the first row, 140532 should be 140562 all the way down.

How do I add 30 to each value in the rfidTag column without going through the whole table editing them individually. What is the sql the command I need to use?

Upvotes: 0

Views: 61

Answers (1)

StevieG
StevieG

Reputation: 8709

UPDATE shipmentdetailstable 
SET rfidTag = rfidTag + 30

Upvotes: 2

Related Questions