Devide columns

Discussion in 'PHP' started by lammspillning, Jan 17, 2008.

  1. #1
    Ok I think this is rather basic..
    How would I do if I want to devide a value in a column with a value in another column in a table?
    I want to devide the value in my column "vote_sum" with the value in "vote_tot",so that I get an average value and echo it. I'm not sure how to do this..//thanx
     
    lammspillning, Jan 17, 2008 IP
  2. neanton

    neanton Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SELECT vote_sum/vote_tot AS average FROM table
     
    neanton, Jan 17, 2008 IP