query for updating fraction value

Discussion in 'Databases' started by php_techy, Jul 20, 2009.

  1. #1
    HI,
    My table has 2 fields Id,Marks.
    Marks can be 100/200.Now I want to update marks by 2 ways.
    1) add 5 to both numerator and denominator i,e 105/205.
    2) add 5 to numerator i,e 105/200.
    What is the way to implement this?
    Regards
     
    php_techy, Jul 20, 2009 IP
  2. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Probably by redesigning your database.

    There is no datatype for 'fraction'. Sounds like you are storing numeric values in a non-numeric field. Also, sounds like you are storing more than one piece of information in a single field--another problem. My suggestion would be to break out Marks into 2 fields of numeric datatypes, from there you can easily do an update query that simply adds 5 to both fields.
     
    plog, Jul 20, 2009 IP