0
 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?

3
  • Does every 'rfidTag' column have a valid rfidTag? If so the supplied answer will be fine, as will null values. If you use 'indicator values' such as zero, to indicate different 'states' then you may want to ignore those. Just a thought. Commented Sep 29, 2014 at 15:20
  • I'm not sure this is such a good idea? Commented Sep 29, 2014 at 15:25
  • There was no null or zero values in my rfidTag column so it solved my issue, but yes that probably should be considered if someone is thinking about using the chosen answer in the future. Commented Sep 29, 2014 at 15:50

1 Answer 1

2
UPDATE shipmentdetailstable 
SET rfidTag = rfidTag + 30
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.