How to update and deduct 1000 from all rows..

Discussion in 'Databases' started by nvidura, Aug 26, 2007.

  1. #1
    database column before executing any query

    int
    1200
    1300
    1400
    1500
    etc...(about 8000 records)
    *All attributes are larger than 1000 and less than 2000

    I need to update and deduct 1000 from all records. Final output of this table should be this

    int
    200
    300
    400
    500
    etc...

    is it possible to do this only by using SQL statements?

    Thanks
     
    nvidura, Aug 26, 2007 IP
  2. saidev

    saidev Well-Known Member

    Messages:
    328
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    140
    #2
    update [table] set [column] = ([column] - 1000);
     
    saidev, Aug 26, 2007 IP
    nvidura likes this.
  3. nvidura

    nvidura Well-Known Member

    Messages:
    1,780
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    150
    #3
    Yes, That's exactly what i wanted.. Thanks for being such a wonderful helper...
     
    nvidura, Aug 26, 2007 IP